Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 302751 - [RHEL 5] GDB fails to break in the $delete destructor
[RHEL 5] GDB fails to break in the $delete destructor
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gdb (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jan Kratochvil
: Patch
Depends On: 298061
  Show dependency treegraph
Reported: 2007-09-24 04:04 EDT by Jan Kratochvil
Modified: 2008-05-21 12:55 EDT (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2008-0332
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-05-21 12:55:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2008:0332 normal SHIPPED_LIVE gdb bug fix and enhancement update 2008-05-20 13:58:35 EDT

  None (edit)
Description Jan Kratochvil 2007-09-24 04:04:35 EDT
Description of problem:
When I am trying to set breakpoint on a destructor, which has virtual destructor
in its inheritance, using 'b class::~class' form, gdb sets the breakpoint, but
it does not get hit when program is run. Gdb most likely setting this breakpoint
on a incorrect PC address, or setting it on non in-charge destructor, which
never gets called.

How reproducible:
See attached testcase

-- Additional comment from jan.kratochvil@redhat.com on 2007-09-20 10:26 EST --

Comment 1 lists the command 'b class::~class', I agree this command does not
target the destructor variant used in the testcase.

(1) Please use apostrophes to quote the destructor (/constructor) names
    themselves, such as:
    (gdb) b 'my::~my'

(2) You may use <tab>-completion if you use the quotation as above:
    (gdb) b 'my::~my<tab>

(3) In this specific testcase of the provided it_file 101926
               you should use:
    (gdb) b 'my::~my$delete()'

(4) There is a break-point menu provided if the specified name qualifies for
    multiple functions:
    (gdb) b 'A::A'
    [0] cancel
    [1] all
    [2] A::A() at /tmp/constructor.C:9
    [3] A::A(int) at /tmp/constructor.C:10
    [4] A::A(long) at /tmp/constructor.C:11
    [5] A::A$base() at /tmp/constructor.C:9

    It may be considered a Bug in the Red Hat branch of the GDB that it does not
    offer the `$delete' destructor variants in this menu.  Therefore
    (gdb) b 'my::~my'
    only resolves to a single destructor instance and thus no menu is displayed.
    With the proposed fix there would be some menu like:
    (gdb) b 'my::~my'
    [0] cancel
    [1] all
    [2] my::~my() at destructor.cxx:24
    [3] my::~my$delete() at destructor.cxx:24

(5) Another Bug targets the proper rewrite of this constructors/destructors
    handling by GDB.  The current Jeff Johnston's patches use the .symtab
    section and depend on the DW_AT_MIPS_linkage_name DWARF tags.  This is
    wrong as it should all be based on the unnamed DWARF .debug_info PC ranges.
    I already spent a lot of time on this patch but I still do not have it
    finished right now.  Still I hope to get it upstream submittable soon.

Suggesting to consider this Bug as the target for (4) - to update
add_minsym_members() in gdb-6.3-linespec-20041213.patch to also list the
`$delete' variant of the destructor.  Only the $allocate variant of the
constructors is defined in the patch gdb-6.3-constructor-20041216.patch but
AFAIK gcc never uses this one.  This the patch may also include even this one.

-- Additional comment from jan.kratochvil@redhat.com on 2007-09-21 11:41 EST --

here is the proposed implementation:

(gdb) b my::~my
[0] cancel
[1] all
[2] my::~my() at destructor.cxx:24
[3] my::~my$delete() at destructor.cxx:24
> 1
Breakpoint 3 at 0x400e2a: file destructor.cxx, line 24.
Breakpoint 4 at 0x400db8: file destructor.cxx, line 24.
warning: Multiple breakpoints were set.
warning: Use the "delete" command to delete unwanted breakpoints.

(gdb) b 25
Breakpoint 1 at 0x400dd1: file destructor.cxx, line 25.
Breakpoint 2 at 0x400e43: file destructor.cxx, line 25.
warning: Multiple breakpoints were set.
warning: Use the "delete" command to delete unwanted breakpoints.
Comment 4 RHEL Product and Program Management 2007-10-15 23:38:37 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
Comment 11 errata-xmlrpc 2008-05-21 12:55:27 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.