Bug 612253

Summary: internal error when setting breakpoint on add_new_name_mapping
Product: [Fedora] Fedora Reporter: joern
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 15CC: jan.kratochvil, pmuldoon, stransky, swagiaal, tromey
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: gdb-7.2.90.20110429-36.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-10 03:32:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
cc1plus binary - compressed with xz none

Description joern 2010-07-07 16:57:58 UTC
Description of problem:

When setting a breakpoint on a specific function, the debugger crashes.


Version-Release number of selected component (if applicable):

GNU gdb (GDB) Fedora (7.1-28.fc13)

How reproducible:

build gcc from FSF trunk revision 160832.

Steps to Reproduce:

1.
get gcc sources from FSF trunk revision 160832, configure, build 'all-gcc'

Well, I'll see if I can attach my cc1plus binary.

2.
gdb --args ./cc1plus -fpreprocessed t.gk.ii -quiet -dumpbase t.c.gk -march=pentiumpro -mtune=generic -m32 -auxbase t -gtoggle -O2 -w -version -fcompare-debug=-gtoggle -fcompare-debug-second -o /dev/null -frandom-seed=0xad9564b2 -fdump-final-insns=t.gk.gkd

3. Enter the command:

break add_new_name_mapping
  
Actual results:

(gdb) break add_new_name_mapping
../../gdb/breakpoint.c:6594: internal-error: expand_line_sal_maybe: Assertion `found' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) 

Expected results:

Setting breakpoint without complaint.

Additional info:

$ nm cc1plus|grep add_new_name_mapping
085be0b0 t add_new_name_mapping

Comment 1 joern 2010-07-07 17:33:57 UTC
Created attachment 430126 [details]
cc1plus binary - compressed with xz

Comment 2 Tom Tromey 2010-07-09 20:31:23 UTC
I can confirm that this fails with the upstream gdb as well.

Comment 3 Jan Kratochvil 2010-07-27 22:26:36 UTC
*** Bug 618637 has been marked as a duplicate of this bug. ***

Comment 4 Jan Kratochvil 2010-07-28 22:40:48 UTC
Post upstream:
http://sourceware.org/ml/gdb-patches/2010-07/msg00533.html

Comment 5 Fedora Admin XMLRPC Client 2011-01-06 03:24:46 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Jan Kratochvil 2011-03-13 15:42:17 UTC
One of the problems is that GDB tries to skip prologue even for -O2 -g code.
There is no such reason as with -O2 -g the debug info is correct for each instructions.  With -O0 -g there are frame-related absolute addresses of autovariables which is the reason GDB needs to skip the prologue to have valid location of such -O0 -g autovariables.

-O2 -g code can be detected for a Compilation Unit if there is referenced any location list from that CU (suggested by GCC hackers).  In such case skipping prologues should be disabled.

  Compilation Unit @ offset 0x90398e:
 <0><903999>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <90399f>   DW_AT_name        : ../../gcc/gcc/tree-into-ssa.c
    <9039a3>   DW_AT_comp_dir    : /user/inria/fsf/160832/bld-2/gcc
 <1><91073a>: Abbrev Number: 69 (DW_TAG_subprogram)
    <91073b>   DW_AT_name        : add_new_name_mapping
 <2><910751>: Abbrev Number: 75 (DW_TAG_formal_parameter)
    <910752>   DW_AT_name        : new_tree
    <910759>   DW_AT_type        : <0x903ea5>
    <91075d>   DW_AT_location    : 0x59d960     (location list)
                                                ^^^^^^^^^^^^^^^

(gdb) break add_new_name_mapping
->
(gdb) p/x original_pc
$1 = 0x85be0bd

085be0b0 <add_new_name_mapping>:
 85be0b0:       55                      push   %ebp
 85be0b1:       89 e5                   mov    %esp,%ebp
 85be0b3:       57                      push   %edi
 85be0b4:       56                      push   %esi
 85be0b5:       89 c6                   mov    %eax,%esi
 85be0b7:       53                      push   %ebx
 85be0b8:       89 d3                   mov    %edx,%ebx
 85be0ba:       83 ec 4c                sub    $0x4c,%esp
 85be0bd:       80 3d a0 8c ca 08 00    cmpb   $0x0,0x8ca8ca0
 ^^^^^^^

There are other problems but this is the first step which should make the problems at least no longer affecting this specific case.

Comment 7 Jan Kratochvil 2011-04-29 08:06:23 UTC
[rfc, 7.3?] -O2 -g breakpoints internal error + prologue skipping
http://sourceware.org/ml/gdb-patches/2011-04/msg00229.html

Comment 8 Fedora Update System 2011-04-29 08:13:25 UTC
gdb-7.2.90.20110429-35.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/gdb-7.2.90.20110429-35.fc15

Comment 9 Fedora Update System 2011-04-30 00:47:24 UTC
Package gdb-7.2.90.20110429-35.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing gdb-7.2.90.20110429-35.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/gdb-7.2.90.20110429-35.fc15
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2011-05-02 14:28:13 UTC
gdb-7.2.90.20110429-36.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/gdb-7.2.90.20110429-36.fc15

Comment 11 Fedora Update System 2011-05-10 03:32:47 UTC
gdb-7.2.90.20110429-36.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.