From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2041) id 27142385E012; Mon, 25 Jul 2022 22:07:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27142385E012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Vladimir Mezentsev 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 X-Act-Checkin: binutils-gdb X-Git-Author: Ruud van der Pas X-Git-Refname: refs/heads/master X-Git-Oldrev: 2e2a82421ac0c817d433d2698ed29ce84d1f1574 X-Git-Newrev: 408520bcaa874edb0e37506e8559b2e4194dca05 Message-Id: <20220725220742.27142385E012@sourceware.org> Date: Mon, 25 Jul 2022 22:07:42 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2022 22:07:42 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D408520bcaa87= 4edb0e37506e8559b2e4194dca05 commit 408520bcaa874edb0e37506e8559b2e4194dca05 Author: Ruud van der Pas Date: Fri Jul 22 06:21:49 2022 -0700 gprofng: fix bug 29353 - Fix a lay-out issue in the html disassembly fi= les =20 gprofng/Changelog: 2022-07-22 Ruud van der Pas =20 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-displa= y-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 =20 $dis_regex =3D '^(#{2}|\s{2})\s+'; $dis_regex .=3D '(.*)'; - $dis_regex .=3D '\[\s*([0-9?]+)\]\s+([0-9a-fA-F]+):\s+([a-z0-9]+)\s+(.*)= '; +## $dis_regex .=3D '\[\s*([0-9?]+)\]\s+([0-9a-fA-F]+):\s+([a-z0-9]+)\s+(.= *)'; + $dis_regex .=3D '\[\s*([0-9?]+)\]\s+([0-9a-fA-F]+):\s+([a-z0-9]+)(.*)'; =20 gp_message ("debugXL", $subr_name, "metric_regex =3D $metric_regex"); gp_message ("debugXL", $subr_name, "dis_regex =3D $dis_regex"); @@ -5475,15 +5476,22 @@ sub generate_dis_html =20 if ( $input_line =3D~ /$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 =3D $1; $metric_values =3D $2; $src_line =3D $3; $dec_instr_address =3D bigint::hex ($4); $instruction =3D $5; - $operands =3D $6; + if (defined ($6)) + { + my $white_space_regex =3D '\s*'; + $operands =3D $6; + $operands =3D~ s/$white_space_regex//; + } =20 if ($hot_line eq "##") { @@ -5550,15 +5558,23 @@ sub generate_dis_html my $input_line =3D $disassembly_file[$line_no]; if ( $input_line =3D~ /$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 =3D $1; $metric_values =3D $2; $src_line =3D $3; $dec_instr_address =3D bigint::hex ($4); $instruction =3D $5; - $operands =3D $6; +## $operands =3D $6; + if (defined ($6)) + { + my $white_space_regex =3D '\s*'; + $operands =3D $6; + $operands =3D~ s/$white_space_regex//; + } =20 if (defined ($dec_instruction_start)) { @@ -5610,8 +5626,9 @@ sub generate_dis_html if ( $input_line =3D~ /$dis_regex/ ) { gp_message ("debugXL", $subr_name, "found a disassembly line: $i= nput_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} =3D 1; # $extended_branch_target{$instruction_address} =3D $= raw_hex_branch_target; @@ -5620,9 +5637,17 @@ sub generate_dis_html $src_line =3D $3; $orig_hex_instr_address =3D $4; $instruction =3D $5; - $operands =3D $6; +## $operands =3D $6; =20 - gp_message ("debugXL", $subr_name, "disassembly line: $1 $2 = $3 $4 $5 \$6 =3D $6"); + my $msg =3D "disassembly line: $1 $2 $3 $4 $5"; + if (defined ($6)) + { + $msg .=3D " \$6 =3D $6"; + my $white_space_regex =3D '\s*'; + $operands =3D $6; + $operands =3D~ s/$white_space_regex//; + } + gp_message ("debugXL", $subr_name, $msg); =20 #-------------------------------------------------------------------------= ----- # Pad the line with the metrics to ensure correct alignment.