GDB 9+ can't examine any exported D symbols from another module

Bug #2089805 reported by Zixing Liu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdb
New
Medium
gdb (Ubuntu)
New
Undecided
Unassigned

Bug Description

GDB 9+ can't examine exported D symbols from another D module when the imported symbol is imported inside a function (subprogram).

Revision history for this message
In , Zixing Liu (liushuyu-011) wrote :

Created attachment 15807
Suggested patch for this issue

This seems to be a regression: GDB 9+ can't examine exported D symbols from another D module when the imported symbol is imported inside a function (subprogram).

For example, in file a.d, we have:

__gshared float b_Glob = 55.22;

In file b.d, we have:

void main()
{
  import a;
  b_Glob = 99.88; // GDB: p b_Glob
  return; //#break
}

When you build the program using:

gdc -ggdb3 -O0 a.d b.d -o a

And then run `gdb ./a` with the following command inputs, and you will see:

(gdb) b b.d:5
Breakpoint 1 at 0x252da: file /tmp/b.d, line 5.
(gdb) r
Starting program: /tmp/a
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Breakpoint 1, D main () at /tmp/b.d:5
5 return; //#break
(gdb) p b_Glob
No symbol "b_Glob" in current context.
(gdb)

With GDB 9, you will see the expected print-out (on amd64) of:

$1 = 99.8799973

-----------------

I suspect this is an issue with how GDB reads imported modules and investigated this to be an accidental regression caused by a refactor to dwarf2/read.c. Please see my suggested patch attached.

Changed in gdb:
importance: Unknown → Medium
status: Unknown → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.