[Bug gdb/24517] New: DW_AT_main_subprogram ignored with readnow

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24517] New: DW_AT_main_subprogram ignored with readnow

alahay01 at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24517

            Bug ID: 24517
           Summary: DW_AT_main_subprogram ignored with readnow
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

With the main-subprogram executable (the test-case for PR16264), without
-readnow we end up in mymain, as expected:
...
$ ./gdb -batch
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/main-subprogram/main-subprogram
 -ex start
Temporary breakpoint 1 at 0x4004ab

Temporary breakpoint 1, 0x00000000004004ab in mymain ()

...

But with -readnow, we end up in main instead:
...
$ ./gdb -readnow -batch
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/main-subprogram/main-subprogram.stripped
 -ex start
Temporary breakpoint 1 at 0x4004b6

Temporary breakpoint 1, 0x00000000004004b6 in main ()
...

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug gdb/24517] DW_AT_main_subprogram ignored with readnow

alahay01 at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24517

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b0bdecf96f..229877dded 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -13741,6 +13741,10 @@ read_func_scope (struct die_info *die, struct
dwarf2_cu *cu)
   newobj->name = new_symbol (die, read_type_die (die, cu), cu,
                             (struct symbol *) templ_func);

+  attr = dwarf2_attr (die, DW_AT_main_subprogram, cu);
+  if (attr)
+    set_objfile_main_name (objfile, SYMBOL_LINKAGE_NAME (newobj->name),
cu->language);
+
   /* If there is a location expression for DW_AT_frame_base, record
      it.  */
   attr = dwarf2_attr (die, DW_AT_frame_base, cu);
...

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug symtab/24517] DW_AT_main_subprogram ignored with readnow

alahay01 at gcc dot gnu.org
In reply to this post by alahay01 at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24517

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gdb                         |symtab

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug symtab/24517] DW_AT_main_subprogram ignored with readnow

alahay01 at gcc dot gnu.org
In reply to this post by alahay01 at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24517

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
patch submitted: https://sourceware.org/ml/gdb-patches/2019-05/msg00156.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug symtab/24517] DW_AT_main_subprogram ignored with readnow

alahay01 at gcc dot gnu.org
In reply to this post by alahay01 at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24517

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <[hidden email]>:

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

commit 81873cc81effbd657efe5f525d369e430ce77d7a
Author: Tom de Vries <[hidden email]>
Date:   Mon Jun 10 09:28:30 2019 +0200

    [gdb/symtab] Support DW_AT_main_subprogram with -readnow.

    DW_AT_main_subprogram is supported in normal mode in read_partial_die, but
not
    in -readnow mode.

    Fix this by adding support for DW_AT_main_subprogram in read_func_scope.

    Tested on x86_64-linux with native and RFC target board readnow (
    https://sourceware.org/ml/gdb-patches/2019-05/msg00073.html ).

    gdb/ChangeLog:

    2019-06-10  Tom de Vries  <[hidden email]>

        PR symtab/16264
        PR symtab/24517
        * dwarf2read.c (read_func_scope): Handle DW_AT_main_subprogram.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug symtab/24517] DW_AT_main_subprogram ignored with readnow

alahay01 at gcc dot gnu.org
In reply to this post by alahay01 at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24517

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed.

--
You are receiving this mail because:
You are on the CC list for the bug.