gprofng: fix build with -mx32

gprofng/ChangeLog
2022-05-27  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/28983
	PR gprofng/29143
	* src/Experiment.cc (write_header): Fix argument for ctime.
	Fix -Wformat= warnings.
	* src/Dbe.cc: Likewise.
	* src/DwarfLib.h: Fix [-Wsign-compare] warnings.
	* src/Experiment.h: Likewise.
	* src/ipc.cc: Fix -Wformat= warnings.
This commit is contained in:
Vladimir Mezentsev 2022-05-27 19:54:26 -07:00
parent 4fb8f32e40
commit 6094a48ec8
5 changed files with 21 additions and 19 deletions

View File

@ -1944,21 +1944,19 @@ dbeGetOverviewText (int dbevindex)
info->append (dbe_sprintf (GTXT (" Target : '%s'"), field)); info->append (dbe_sprintf (GTXT (" Target : '%s'"), field));
field = exp->hostname; field = exp->hostname;
if (field && field[0]) if (field && field[0])
info->append (dbe_sprintf (NTXT (" %s %s (%s, %s)"), info->append (dbe_sprintf (GTXT (" Host : %s (%s, %s)"),
GTXT ("Host :"),
field, field,
exp->architecture ? exp->architecture exp->architecture ? exp->architecture
: GTXT ("<CPU architecture not recorded>"), : GTXT ("<CPU architecture not recorded>"),
exp->os_version ? exp->os_version exp->os_version ? exp->os_version
: GTXT ("<OS version not recorded>"))); : GTXT ("<OS version not recorded>")));
long start_sec = exp->start_sec; time_t start_sec = (time_t) exp->start_sec;
char *p = ctime (&start_sec); // does this need to be freed? YXXX char *p = ctime (&start_sec);
hrtime_t tot_time = dbeCalcGroupDuration (grInd); hrtime_t tot_time = dbeCalcGroupDuration (grInd);
double seconds = tot_time * 1.e-9; double seconds = tot_time * 1.e-9;
info->append (dbe_sprintf (NTXT (" %s %s %s %0.3f %s"), info->append (dbe_sprintf (
GTXT ("Start Time :"), p, GTXT (" Start Time : %s Duration : %0.3f Seconds"),
GTXT ("Duration :"), seconds, p, seconds));
GTXT ("Seconds")));
// Number of descendants/processes would be nice // Number of descendants/processes would be nice
info->append (dbe_strdup (NTXT (""))); info->append (dbe_strdup (NTXT ("")));
} }

View File

@ -152,9 +152,9 @@ private:
uint64_t timestamp; uint64_t timestamp;
uint64_t file_size; uint64_t file_size;
uint64_t address; uint64_t address;
uint32_t file; int file;
uint32_t line; int line;
uint32_t column; int column;
Dwarf_Half version; Dwarf_Half version;
uint64_t op_index_register; uint64_t op_index_register;
Dwarf_Small maximum_operations_per_instruction; Dwarf_Small maximum_operations_per_instruction;

View File

@ -644,7 +644,7 @@ Experiment::ExperimentHandler::startElement (char*, char*, char *qName, Attribut
exp->exp_start_time = ts; exp->exp_start_time = ts;
str = attrs->getValue (NTXT ("time")); str = attrs->getValue (NTXT ("time"));
if (str != NULL) if (str != NULL)
exp->start_sec = atol (str); exp->start_sec = atoll (str);
str = attrs->getValue (NTXT ("pid")); str = attrs->getValue (NTXT ("pid"));
if (str != NULL) if (str != NULL)
exp->pid = atoi (str); exp->pid = atoi (str);
@ -4136,7 +4136,8 @@ Experiment::write_header ()
if (dbeSession->ipc_mode || dbeSession->rdt_mode) if (dbeSession->ipc_mode || dbeSession->rdt_mode)
{ {
// In GUI: print start time at the beginning // In GUI: print start time at the beginning
char *start_time = ctime (&start_sec); time_t t = (time_t) start_sec;
char *start_time = ctime (&t);
if (start_time != NULL) if (start_time != NULL)
{ {
sb.setLength (0); sb.setLength (0);
@ -4258,7 +4259,8 @@ Experiment::write_header ()
} }
// add comment for start time // add comment for start time
char *p = ctime (&start_sec); time_t t = (time_t) start_sec;
char *p = ctime (&t);
sb.setLength (0); sb.setLength (0);
if (p != NULL) if (p != NULL)
sb.sprintf (GTXT ("Experiment started %s"), p); sb.sprintf (GTXT ("Experiment started %s"), p);
@ -6444,9 +6446,11 @@ Experiment::dump_map (FILE *outfile)
load.tv_nsec += NANOSEC; load.tv_nsec += NANOSEC;
} }
fprintf (outfile, fprintf (outfile,
"0x%08llx %8lld (0x%08llx) %5ld.%09ld %5ld.%09ld \"%s\"\n", "0x%08llx %8lld (0x%08llx) %5lld.%09lld %5lld.%09lld \"%s\"\n",
s->base, s->size, s->size, load.tv_sec, load.tv_nsec, (long long) s->base, (long long) s->size, (long long) s->size,
unload.tv_sec, unload.tv_nsec, s->obj->get_name ()); (long long) load.tv_sec, (long long) load.tv_nsec,
(long long) unload.tv_sec, (long long) unload.tv_nsec,
s->obj->get_name ());
} }
fprintf (outfile, NTXT ("\n")); fprintf (outfile, NTXT ("\n"));
} }

View File

@ -114,7 +114,7 @@ public:
// Configuration Information // Configuration Information
char *hostname; // Hosthame (e.g. mymachine) char *hostname; // Hosthame (e.g. mymachine)
long start_sec; // Starting timeval secs. hrtime_t start_sec; // Starting timeval secs.
char *username; // name of person performing the test char *username; // name of person performing the test
char *architecture; // Architecture name ("sun4") char *architecture; // Architecture name ("sun4")
Platform_t platform; // Sparc,Sparcv9,Intel Platform_t platform; // Sparc,Sparcv9,Intel

View File

@ -1281,7 +1281,7 @@ ipc_doWork (void *arg)
{ {
int arg1 = readInt (req); int arg1 = readInt (req);
uint64_t arg2 = readLong (req); uint64_t arg2 = readLong (req);
ipc_log (" args = %d, %ld\n", arg1, arg2); ipc_log (" args = %d, %lld\n", arg1, (long long) arg2);
dbeSetSelObjV2 (arg1, arg2); dbeSetSelObjV2 (arg1, arg2);
writeString (NULL, req); writeString (NULL, req);
} }