From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7275 invoked by alias); 5 Jun 2011 13:28:44 -0000 Received: (qmail 7261 invoked by uid 22791); 5 Jun 2011 13:28:42 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SARE_OBFU_ALL,SPF_HELO_PASS,TW_BJ,TW_CX,TW_DC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 05 Jun 2011 13:28:25 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p55DSOi4031374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 5 Jun 2011 09:28:25 -0400 Received: from host1.jankratochvil.net (ovpn-113-49.phx2.redhat.com [10.3.113.49]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p55DSJ1p001721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 5 Jun 2011 09:28:24 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p55DSHHP029746; Sun, 5 Jun 2011 15:28:17 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p55DSFE9029735; Sun, 5 Jun 2011 15:28:15 +0200 Date: Sun, 05 Jun 2011 13:28:00 -0000 From: Jan Kratochvil To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA] 12266 (typedef'd parameters) revisited again Message-ID: <20110605132815.GA26101@host1.jankratochvil.net> References: <4DE96F46.5010509@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="xXmbgvnjoT4axfJE" Content-Disposition: inline In-Reply-To: <4DE96F46.5010509@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00067.txt.bz2 --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 5517 On Sat, 04 Jun 2011 01:33:26 +0200, Keith Seitz wrote: > Of course, it is still possible that I've neglected something along > the line. This patch crashes for me on: ./gdb -nx -ex "b '__gnu_cxx::__detail::__mini_vector::_Alloc_block*, __gnu_cxx::bitmap_allocator::_Alloc_block*> >::deallocate(std::pair<__gnu_cxx::bitmap_allocator::_Alloc_block*, __gnu_cxx::bitmap_allocator::_Alloc_block*>*, unsigned long)'" ~/t/libstdc++.so.6.0.16 -ex q where libstdc++.so.6.0.16 has build-id 3b4e74185daae5c573056df66b5807908029eac8 , it is associated by its .debug file and comes from gcc-4.6.0-7.fc15.x86_64. valgring first problematic crash is below. Attaching scripts/patches I use to reach at the pre-physname functionality without regressions, that is to be able to at least: (gdb) break 'function name as seen in nm -C' gdb-breakpoint.pl - run by: for i in variant-to-run;do time ~/t/gdb-breakpoint.pl 0 ~/t/gdb-$i ~/redhat/binutils-clean/binutils/nm-new-{clean,retdrop} ~/t/libstdc++.so.6.0.16 >~/t/gdb-breakpoint-out-libstdcxx-$i; time ~/t/gdb-breakpoint.pl 0 ~/t/gdb-$i ~/redhat/binutils-clean/binutils/nm-new-{clean,retdrop} ~/t/libwebkitgtk-1.0.so.0.5.2 >~/t/gdb-breakpoint-out-libwebkit-$i;done - nm-new-retdrop is nm patched for DMGL_RET_DROP gdb-breakpoint-fix.pl - some postprocessing of the output from gdb-breakpoint.pl gdb-breakpoint-diff.pl - comparison of two files to reach 0 regressions against pre-physname GDB gdb-breakpoint-O2g.patch - workaround GDB PR 12822 - Assertion `found' failed. gdb-breakpoint-hack_count-old.patch gdb-breakpoint-hack_count-new.patch - workaround GDB PR 12828 - Too slow break on -O2 -g code - two variants for pre-physname and recent GDB sources Some stats out of gdb-breakpoint-diff.pl: pre-phys -> jan prev bad: 1324 now bad: 53 both bad: 53 regression: 0 improvement: 1271 both good: 47619 pre-phys -> master prev bad: 1324 now bad: 3243 both bad: 813 regression: 2430 improvement: 511 both good: 45189 master -> jan prev bad: 3243 now bad: 53 both bad: 53 regression: 0 improvement: 3190 both good: 45700 Thanks, Jan Invalid read of size 8 at 0x5E8B2B6: __memcpy_ssse3_back (memcpy-ssse3-back.S:1624) by 0x41A5D0: mem_file_write (ui-file.c:457) by 0x419DF9: ui_file_write (ui-file.c:214) by 0x4223B3: replace_typedefs_qualified_name (cp-support.c:224) by 0x422585: replace_typedefs (cp-support.c:294) by 0x4225BF: replace_typedefs (cp-support.c:309) by 0x422538: replace_typedefs (cp-support.c:285) by 0x4225A2: replace_typedefs (cp-support.c:304) by 0x422493: replace_typedefs_qualified_name (cp-support.c:254) by 0x422585: replace_typedefs (cp-support.c:294) by 0x4225BF: replace_typedefs (cp-support.c:309) by 0x422538: replace_typedefs (cp-support.c:285) by 0x4225A2: replace_typedefs (cp-support.c:304) by 0x4225A2: replace_typedefs (cp-support.c:304) by 0x42264D: cp_canonicalize_string_no_typedefs (cp-support.c:338) by 0x61FD06: find_methods (linespec.c:252) by 0x6232B3: find_method (linespec.c:1747) by 0x622CAA: decode_compound (linespec.c:1599) by 0x621779: decode_line_1 (linespec.c:939) by 0x5CF964: parse_breakpoint_sals (breakpoint.c:7739) by 0x5D0341: create_breakpoint (breakpoint.c:7971) by 0x5D0AEC: break_command_1 (breakpoint.c:8203) by 0x5D0CA4: break_command (breakpoint.c:8276) by 0x58D724: do_cfunc (cli-decode.c:67) by 0x5908A9: cmd_func (cli-decode.c:1777) by 0x411BF1: execute_command (top.c:435) by 0x644FDF: catch_command_errors (exceptions.c:522) by 0x407E70: captured_main (main.c:913) by 0x644F44: catch_errors (exceptions.c:506) by 0x407F05: gdb_main (main.c:946) by 0x406BA2: main (gdb.c:35) Address 0xda91035 is 11 bytes before a block of size 227,731,995 alloc'd at 0x4C284F2: realloc (vg_replace_malloc.c:525) by 0x415552: xrealloc (utils.c:1270) by 0x41A59B: mem_file_write (ui-file.c:455) by 0x419DF9: ui_file_write (ui-file.c:214) by 0x4223B3: replace_typedefs_qualified_name (cp-support.c:224) by 0x422585: replace_typedefs (cp-support.c:294) by 0x4225BF: replace_typedefs (cp-support.c:309) by 0x422538: replace_typedefs (cp-support.c:285) by 0x4225A2: replace_typedefs (cp-support.c:304) by 0x422493: replace_typedefs_qualified_name (cp-support.c:254) by 0x422585: replace_typedefs (cp-support.c:294) by 0x4225BF: replace_typedefs (cp-support.c:309) by 0x422538: replace_typedefs (cp-support.c:285) by 0x4225A2: replace_typedefs (cp-support.c:304) by 0x4225A2: replace_typedefs (cp-support.c:304) by 0x42264D: cp_canonicalize_string_no_typedefs (cp-support.c:338) by 0x61FD06: find_methods (linespec.c:252) by 0x6232B3: find_method (linespec.c:1747) by 0x622CAA: decode_compound (linespec.c:1599) by 0x621779: decode_line_1 (linespec.c:939) by 0x5CF964: parse_breakpoint_sals (breakpoint.c:7739) by 0x5D0341: create_breakpoint (breakpoint.c:7971) by 0x5D0AEC: break_command_1 (breakpoint.c:8203) by 0x5D0CA4: break_command (breakpoint.c:8276) by 0x58D724: do_cfunc (cli-decode.c:67) by 0x5908A9: cmd_func (cli-decode.c:1777) by 0x411BF1: execute_command (top.c:435) by 0x644FDF: catch_command_errors (exceptions.c:522) by 0x407E70: captured_main (main.c:913) by 0x644F44: catch_errors (exceptions.c:506) by 0x407F05: gdb_main (main.c:946) by 0x406BA2: main (gdb.c:35) --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-breakpoint.pl" Content-length: 2490 #! /usr/bin/perl # perl -i -p -e 's/^(Breakpoint )(?:\d+ )?(?:at 0x[0-9a-f]+ )?/$1/' use strict; use warnings; use Data::Dumper; use List::Util qw(&shuffle); my $BATCH=500; my $die; @ARGV>=5 or die "$0 ..."; my $limit=shift; my $gdb=shift; my $nm=shift; my $nm_retdrop=shift; $limit=~/^\d+$/ or die "limit is not numeric: $limit"; $limit or undef $limit; -x $gdb or die "-x $gdb"; -x $nm or die "-x $nm"; -x $nm_retdrop or die "-x $nm_retdrop"; #system "cgclassify -g '*':hammock $$ &>/dev/null"; system "renice +19 -p $$ &>/dev/null"; system "ionice -c3 -p $$ &>/dev/null"; srand 0; while (@ARGV) { my $file=shift; my $debug="${file}.debug"; warn "$file\n"; -r $file or die "-r $file"; -r $debug or die "-r $debug"; my %break; sub nm($) { my($nm_kind)=@_; my $f="$nm_kind -C $debug|"; local *F; open F,$f or die $f; my @retval; while () { chomp; next if !(my $break=(/^.{16} [tT] (.*)$/)[0]); # $break=~s/@.*//; next if $break=~/[.]clone[.]\d+$/; push @retval,$break; die "' in: $break" if $break=~/'/; $break{$break}++; } close F or die $f; return @retval; } my @nm=nm $nm; my @nm_retdrop=nm $nm_retdrop; @nm==@nm_retdrop or die '@nm!=@nm_retdrop'; @nm>0 or die '@nm==0'; warn "minsyms ".scalar(@nm)."\n"; my @break=shuffle(sort(keys(%break))); warn "breaks ".scalar(@break)."\n"; my %h; for my $i (0..$#nm) { my $a=$nm[$i]; my $b=$nm_retdrop[$i]; next if $a eq $b; length($a) > length ($b) or die "$a length $b"; $h{$b}{$a}=1; } warn "function templates ".scalar(keys(%h))."\n"; for my $b (keys(%h)) { my @a=keys(%{$h{$b}}); next if @a==1; print Dumper([$b,\@a]); $die++; } my $break_done=0; while (@break) { local *GDB; my $GDB="|$gdb -nx $file 2>&1"; open GDB,$GDB or die "open $GDB"; print GDB <<"EOH" or die "print $GDB"; set prompt set breakpoint pending off set confirm no set width 0 set height 0 set pagination off set language c++ EOH my $batch_done=0; while (@break && $batch_done < $BATCH) { my $break=shift @break; print GDB <<"EOH" or die "print $GDB"; echo BREAK @{[ sprintf "%6d",$break_done ]} $break\\n b '$break' delete EOH $batch_done++; $break_done++; last if defined $limit && --$limit<=0; } print GDB <<"EOH" or die "print $GDB"; quit EOH close GDB or die "close $GDB"; $? and die "error $? on close $GDB"; last if defined $limit && $limit<=0; } # while (@break); } # while (@ARGV); die $die if $die; --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-breakpoint-fix.pl" Content-length: 143 #! /usr/bin/perl -i -n next if $_ eq "BREAKSTUB\n"; print "BREAKSTUB\n" if /^BREAK/; s/^(Breakpoint )(?:\d+ )?(?:at 0x[0-9a-f]+ )?/$1/; print; --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-breakpoint-diff.pl" Content-length: 1312 #! /usr/bin/perl use strict; use warnings; my $v=0; $v++,shift if ($ARGV[0]||"") eq "-v"; $v++,shift if ($ARGV[0]||"") eq "-v"; @ARGV and @ARGV%1==0 or die "$0: [-v] { }..."; my @s=([0,0],[0,0]); while (@ARGV) { local *F; my $f="(diff -U999999 '".shift."' '".shift."';:)|"; open F,$f or die $f; my($a,$b,$text); while () { my $line=$.-3; chomp; warn "$line:$_\n" if $v; next if $_ eq " BREAKSTUB"; die $_ if /^.BREAKSTUB/; if (/^ BREAK/) { if (!defined $text) {} elsif (!$a && !$b) { print "both bad:$line\n$text"; } elsif ($a && !$b) { print "regression:$line\n$text"; } elsif (!$a && $b && $v>=2) { print "improvement:$line\n$text"; } $s[$a||0][$b||0]++ if defined $text; $a=$b=0; $text="$_\n"; next; } $text.="$_\n" if defined $text; die $_ if /^.BREAK/; my $re=qr/Breakpoint at |\d+ hack_count/o; $a=1 if /^[-]$re/o; $b=1 if /^[+]$re/o; $a=$b=1 if /^ $re/o; } close F or die $f; } printf "prev bad: %5d\n",$s[0][0]+$s[0][1]; printf "now bad: %5d\n",$s[0][0]+$s[1][0]; printf "both bad: %5d\n",$s[0][0]; printf "regression: %5d\n",$s[1][0]; printf "improvement: %5d\n",$s[0][1]; printf "both good: %5d\n",$s[1][1]; --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-breakpoint-O2g.patch" Content-length: 356 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6608,6 +6608,7 @@ expand_line_sal_maybe (struct symtab_and_line sal) return expanded; } +#if 0 if (original_pc) { found = 0; @@ -6619,6 +6620,7 @@ expand_line_sal_maybe (struct symtab_and_line sal) } gdb_assert (found); } +#endif return expanded; } --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-breakpoint-hack_count-old.patch" Content-length: 597 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4771,6 +4771,16 @@ expand_line_sal (struct symtab_and_line sal) lineno = sal.line; match_filename = sal.symtab->filename; +{ int hack_count = 0; + ALL_PSPACES (pspace) + ALL_PSPACE_PSYMTABS (pspace, objfile, psymtab) + { + if (FILENAME_CMP (match_filename, psymtab->filename) == 0) + hack_count++; + } +if (hack_count > 10) error ("%d hack_count", hack_count); +} + /* We need to find all symtabs for a file which name is described by sal. We cannot just directly iterate over symtabs, since a symtab might not be --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-breakpoint-hack_count-new.patch" Content-length: 570 diff --git a/gdb/psymtab.c b/gdb/psymtab.c index ea690ef..38b0ca3 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1073,6 +1073,15 @@ read_psymtabs_with_filename (struct objfile *objfile, const char *filename) { struct partial_symtab *p; +{ int hack_count = 0; + ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p) + { + if (filename_cmp (filename, p->filename) == 0) + hack_count++; + } +if (hack_count > 10) error ("%d hack_count", hack_count); +} + ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p) { if (filename_cmp (filename, p->filename) == 0) --xXmbgvnjoT4axfJE--