public inbox for binutils-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 bug 29353 - Fix a lay-out issue in the html disassembly files
Date: Mon, 25 Jul 2022 22:07:42 +0000 (GMT)	[thread overview]
Message-ID: <20220725220742.27142385E012@sourceware.org> (raw)

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

commit 408520bcaa874edb0e37506e8559b2e4194dca05
Author: Ruud van der Pas <ruud.vanderpas@oracle.com>
Date:   Fri Jul 22 06:21:49 2022 -0700

    gprofng: fix bug 29353 - Fix a lay-out issue in the html disassembly files
    
    gprofng/Changelog:
    2022-07-22  Ruud van der Pas  <ruud.vanderpas@oracle.com>
    
            PR gprofng/29353
            * gp-display-html/gp-display-html.in: fixed a problem in the
            generation of html for the disassembly where instructions
            without arguments were not handled correctly.

Diff:
---
 gprofng/gp-display-html/gp-display-html.in | 41 ++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/gprofng/gp-display-html/gp-display-html.in b/gprofng/gp-display-html/gp-display-html.in
index 8297be62b2f..a2e629a1633 100644
--- a/gprofng/gp-display-html/gp-display-html.in
+++ b/gprofng/gp-display-html/gp-display-html.in
@@ -5406,7 +5406,8 @@ sub generate_dis_html
 
   $dis_regex  = '^(#{2}|\s{2})\s+';
   $dis_regex .= '(.*)';
-  $dis_regex .= '\[\s*([0-9?]+)\]\s+([0-9a-fA-F]+):\s+([a-z0-9]+)\s+(.*)';
+##  $dis_regex .= '\[\s*([0-9?]+)\]\s+([0-9a-fA-F]+):\s+([a-z0-9]+)\s+(.*)';
+  $dis_regex .= '\[\s*([0-9?]+)\]\s+([0-9a-fA-F]+):\s+([a-z0-9]+)(.*)';
 
   gp_message ("debugXL", $subr_name, "metric_regex = $metric_regex");
   gp_message ("debugXL", $subr_name, "dis_regex    = $dis_regex");
@@ -5475,15 +5476,22 @@ sub generate_dis_html
 
       if ( $input_line =~ /$dis_regex/ )
         {
+##          if ( defined ($1) and defined ($2) and defined ($3) and
+##               defined ($4) and defined ($5) and defined ($6) )
           if ( defined ($1) and defined ($2) and defined ($3) and
-               defined ($4) and defined ($5) and defined ($6) )
+               defined ($4) and defined ($5) )
             {
               $hot_line      = $1;
               $metric_values = $2;
               $src_line      = $3;
               $dec_instr_address = bigint::hex ($4);
               $instruction   = $5;
-              $operands      = $6;
+              if (defined ($6))
+                {
+                  my $white_space_regex = '\s*';
+                  $operands = $6;
+                  $operands =~ s/$white_space_regex//;
+                }
 
               if ($hot_line eq "##")
                 {
@@ -5550,15 +5558,23 @@ sub generate_dis_html
       my $input_line = $disassembly_file[$line_no];
       if ( $input_line =~ /$dis_regex/ )
         {
+#          if ( defined ($1) and defined ($2) and defined ($3) and
+##               defined ($4) and defined ($5) and defined ($6) )
           if ( defined ($1) and defined ($2) and defined ($3) and
-               defined ($4) and defined ($5) and defined ($6) )
+               defined ($4) and defined ($5) )
             {
               $hot_line      = $1;
               $metric_values = $2;
               $src_line      = $3;
               $dec_instr_address = bigint::hex ($4);
               $instruction   = $5;
-              $operands      = $6;
+##              $operands      = $6;
+              if (defined ($6))
+                {
+                  my $white_space_regex = '\s*';
+                  $operands = $6;
+                  $operands =~ s/$white_space_regex//;
+                }
 
               if (defined ($dec_instruction_start))
                 {
@@ -5610,8 +5626,9 @@ sub generate_dis_html
       if ( $input_line =~ /$dis_regex/ )
         {
           gp_message ("debugXL", $subr_name, "found a disassembly line: $input_line");
+
           if ( defined ($1) and defined ($2) and defined ($3) and
-               defined ($4) and defined ($5) and defined ($6) )
+               defined ($4) and defined ($5) )
             {
 #                      $branch_target{$hex_branch_target} = 1;
 #                      $extended_branch_target{$instruction_address} = $raw_hex_branch_target;
@@ -5620,9 +5637,17 @@ sub generate_dis_html
               $src_line      = $3;
               $orig_hex_instr_address = $4;
               $instruction   = $5;
-              $operands      = $6;
+##              $operands      = $6;
 
-              gp_message ("debugXL", $subr_name, "disassembly line: $1 $2 $3 $4 $5 \$6 = $6");
+              my $msg = "disassembly line: $1 $2 $3 $4 $5";
+              if (defined ($6))
+                {
+                  $msg .= " \$6 = $6";
+                  my $white_space_regex = '\s*';
+                  $operands = $6;
+                  $operands =~ s/$white_space_regex//;
+                }
+              gp_message ("debugXL", $subr_name, $msg);
 
 #------------------------------------------------------------------------------
 # Pad the line with the metrics to ensure correct alignment.


                 reply	other threads:[~2022-07-25 22:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220725220742.27142385E012@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).