public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Vladimir Mezentsev <vmezents@sourceware.org>
To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org
Subject: [binutils-gdb] gprofng: fix build with -mx32
Date: Sat, 28 May 2022 03:09:31 +0000 (GMT)	[thread overview]
Message-ID: <20220528030931.23D023858401@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6094a48ec821a52731172f3471dce4923a482cd1

commit 6094a48ec821a52731172f3471dce4923a482cd1
Author: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Date:   Fri May 27 19:54:26 2022 -0700

    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.

Diff:
---
 gprofng/src/Dbe.cc        | 14 ++++++--------
 gprofng/src/DwarfLib.h    |  6 +++---
 gprofng/src/Experiment.cc | 16 ++++++++++------
 gprofng/src/Experiment.h  |  2 +-
 gprofng/src/ipc.cc        |  2 +-
 5 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/gprofng/src/Dbe.cc b/gprofng/src/Dbe.cc
index 1a6e5214581..d2cd94bfc19 100644
--- a/gprofng/src/Dbe.cc
+++ b/gprofng/src/Dbe.cc
@@ -1944,21 +1944,19 @@ dbeGetOverviewText (int dbevindex)
 	info->append (dbe_sprintf (GTXT ("  Target        : '%s'"), field));
       field = exp->hostname;
       if (field && field[0])
-	info->append (dbe_sprintf (NTXT ("  %s %s (%s, %s)"),
-				   GTXT ("Host          :"),
+	info->append (dbe_sprintf (GTXT ("  Host          : %s (%s, %s)"),
 				   field,
 				   exp->architecture ? exp->architecture
 				   : GTXT ("<CPU architecture not recorded>"),
 				   exp->os_version ? exp->os_version
 				   : GTXT ("<OS version not recorded>")));
-      long start_sec = exp->start_sec;
-      char *p = ctime (&start_sec); // does this need to be freed? YXXX
+      time_t start_sec = (time_t) exp->start_sec;
+      char *p = ctime (&start_sec);
       hrtime_t tot_time = dbeCalcGroupDuration (grInd);
       double seconds = tot_time * 1.e-9;
-      info->append (dbe_sprintf (NTXT ("  %s %s  %s %0.3f %s"),
-				 GTXT ("Start Time    :"), p,
-				 GTXT ("Duration      :"), seconds,
-				 GTXT ("Seconds")));
+      info->append (dbe_sprintf (
+		GTXT ("  Start Time    : %s  Duration      : %0.3f Seconds"),
+		p, seconds));
       // Number of descendants/processes would be nice
       info->append (dbe_strdup (NTXT ("")));
     }
diff --git a/gprofng/src/DwarfLib.h b/gprofng/src/DwarfLib.h
index 95eff5751ff..07bd60fcb44 100644
--- a/gprofng/src/DwarfLib.h
+++ b/gprofng/src/DwarfLib.h
@@ -152,9 +152,9 @@ private:
   uint64_t timestamp;
   uint64_t file_size;
   uint64_t address;
-  uint32_t file;
-  uint32_t line;
-  uint32_t column;
+  int file;
+  int line;
+  int column;
   Dwarf_Half version;
   uint64_t op_index_register;
   Dwarf_Small maximum_operations_per_instruction;
diff --git a/gprofng/src/Experiment.cc b/gprofng/src/Experiment.cc
index a23c10c30a3..c797724af07 100644
--- a/gprofng/src/Experiment.cc
+++ b/gprofng/src/Experiment.cc
@@ -644,7 +644,7 @@ Experiment::ExperimentHandler::startElement (char*, char*, char *qName, Attribut
 	      exp->exp_start_time = ts;
 	      str = attrs->getValue (NTXT ("time"));
 	      if (str != NULL)
-		exp->start_sec = atol (str);
+		exp->start_sec = atoll (str);
 	      str = attrs->getValue (NTXT ("pid"));
 	      if (str != NULL)
 		exp->pid = atoi (str);
@@ -4136,7 +4136,8 @@ Experiment::write_header ()
   if (dbeSession->ipc_mode || dbeSession->rdt_mode)
     {
       // 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)
 	{
 	  sb.setLength (0);
@@ -4258,7 +4259,8 @@ Experiment::write_header ()
     }
 
   // add comment for start time
-  char *p = ctime (&start_sec);
+  time_t t = (time_t) start_sec;
+  char *p = ctime (&t);
   sb.setLength (0);
   if (p != NULL)
     sb.sprintf (GTXT ("Experiment started %s"), p);
@@ -6444,9 +6446,11 @@ Experiment::dump_map (FILE *outfile)
 	load.tv_nsec += NANOSEC;
       }
     fprintf (outfile,
-	     "0x%08llx  %8lld (0x%08llx) %5ld.%09ld %5ld.%09ld  \"%s\"\n",
-	     s->base, s->size, s->size, load.tv_sec, load.tv_nsec,
-	     unload.tv_sec, unload.tv_nsec, s->obj->get_name ());
+	     "0x%08llx  %8lld (0x%08llx) %5lld.%09lld %5lld.%09lld  \"%s\"\n",
+	     (long long) s->base, (long long) s->size, (long long) s->size,
+	     (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"));
 }
diff --git a/gprofng/src/Experiment.h b/gprofng/src/Experiment.h
index 41c44e4a08a..17c91bda23e 100644
--- a/gprofng/src/Experiment.h
+++ b/gprofng/src/Experiment.h
@@ -114,7 +114,7 @@ public:
 
   // Configuration Information
   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 *architecture;   // Architecture name ("sun4")
   Platform_t platform;  // Sparc,Sparcv9,Intel
diff --git a/gprofng/src/ipc.cc b/gprofng/src/ipc.cc
index 932423cdf0d..edc70256a68 100644
--- a/gprofng/src/ipc.cc
+++ b/gprofng/src/ipc.cc
@@ -1281,7 +1281,7 @@ ipc_doWork (void *arg)
     {
       int arg1 = readInt (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);
       writeString (NULL, req);
     }


             reply	other threads:[~2022-05-28  3:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-28  3:09 Vladimir Mezentsev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-27  6:33 Vladimir Mezentsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220528030931.23D023858401@sourceware.org \
    --to=vmezents@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).