This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20186] New: Cannot print static variable with tag name without default symtab


https://sourceware.org/bugzilla/show_bug.cgi?id=20186

            Bug ID: 20186
           Summary: Cannot print static variable with tag name without
                    default symtab
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: keiths at redhat dot com
  Target Milestone: ---

Consider:

#include <stdlib.h>

struct S {} S;
static struct sS {} *sS = NULL;

int
main (void)
{
  return 0;
}

$ g++ -g static.cc -o static
$ gdb -nx -q static
Reading symbols from ./static...done.
(gdb) p S
$1 = {<No data fields>}
(gdb) p sS
Attempt to use type name as an expression
(gdb) list
1       #include <stdlib.h>
2       
3       struct S {} S;
4       static struct sS {} *sS = NULL;
5       
6       int
7       main (void)
8       {
9         return 0;
10      }
(gdb) p sS
$2 = (sS *) 0x0

Because of the domain problem (in C++ and some other languages, we return
STRUCT_DOMAIN matches for VAR_DOMAIN searches), we need the default symtab set
in order to search the static block. Before running, we apparently do not set
the current source symtab and line, so we pass NULL block to lookup_symbol
in classify_name. block_static_block (NULL) is NULL, and we find no matching
VAR_DOMAIN symbols.

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]