Article View: gnu.gdb.bug
Article #372(none)
From: Peggy Fieland
Date: Thu, 13 Aug 1992 20:14
Date: Thu, 13 Aug 1992 20:14
158 lines
5163 bytes
5163 bytes
I am using gdb-4.6 on a Stratus i860. As the following debugging
session indicates, gdb does not print types defined in inner scopes
when "info types" is issued.
Here is the debugging session. The test program is listed as part
of the session:
maestro-tests% /net/citron/home/citron/pfieland/gdb-4.6/gdb-4.6/gdb/gdbx struct2
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.6, Copyright 1992 Free Software Foundation, Inc...
(gdb) list 1
1 #include <stdio.h>
2
3
4 main()
5 {
(gdb)
6 struct ms
7 {
8 int i;
9 int j;
10 };
11
12 struct ms mystruct;
13
14 mystruct.i = 5;
15 mystruct.j = 10;
(gdb)
16 printf ("%d %d\n", mystruct.i, mystruct.j);
17
18 }
(gdb) b main
Breakpoint 1 at 0x1458: file struct2.c, line 14.
(gdb) r
Starting program: /home2/maestro/pfieland/tests/struct2
`
Breakpoint 1, main () at struct2.c:14
14 mystruct.i = 5;
(gdb) info types
All defined types:
File struct2.c:
struct {
int _cnt;
unsigned char *_ptr;
unsigned char *_base;
unsigned char _flag;
unsigned char _file;
};
struct {
unsigned int ireg_used;
unsigned int freg_used;
long *reg_base;
long *mem_ptr;
};
typedef struct {
int _cnt;
unsigned char *_ptr;
unsigned char *_base;
unsigned char _flag;
unsigned char _file;
} FILE;
typedef long fpos_t;
typedef unsigned int size_t;
typedef struct {
unsigned int ireg_used;
unsigned int freg_used;
long *reg_base;
long *mem_ptr;
} va_list;
(gdb)
Here is the fix:
*** /home/tools/gnu/gdb-4.6/gdb/symtab.c Tue Jul 14 03:34:30 1992
--- gdb-4.6/gdb/symtab.c Thu Aug 13 11:19:41 1992
***************
*** 2141,2146 ****
--- 2182,2188 ----
= {mst_bss, mst_text, mst_abs, mst_unknown};
enum minimal_symbol_type ourtype = types[class];
enum minimal_symbol_type ourtype2 = types2[class];
+ int limit; /* added by Peggy Fieland (Margaret_Fieland@vos.stratus.com) see below */
if (regexp)
{
***************
*** 2186,2198 ****
{
struct partial_symbol *bound, *gbound, *sbound;
int keep_going = 1;
!
if (ps->readin) continue;
gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
bound = gbound;
!
/* Go through all of the symbols stored in a partial
symtab in one loop. */
psym = objfile->global_psymbols.list + ps->globals_offset;
--- 2228,2240 ----
{
struct partial_symbol *bound, *gbound, *sbound;
int keep_going = 1;
!
if (ps->readin) continue;
gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
bound = gbound;
!
/* Go through all of the symbols stored in a partial
symtab in one loop. */
psym = objfile->global_psymbols.list + ps->globals_offset;
***************
*** 2272,2278 ****
It happens that the first symtab in the list
for any given blockvector is the main file. */
if (bv != prev_bv)
! for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
{
b = BLOCKVECTOR_BLOCK (bv, i);
/* Skip the sort if this block is always sorted. */
--- 2314,2332 ----
It happens that the first symtab in the list
for any given blockvector is the main file. */
if (bv != prev_bv)
! /* altered by Peggy Fieland (Margaret_Fieland@vos.stratus.com, so as to make types
! defined in inner scopes visible. Specifically, without this change ,
! "info types" does not show types defined inside blocks or procedures, since
! in dwarf they are NOT automatically installed in the static block. I added
! limit and set it according to the command being executed. */
!
! {
! if (class == 2)
! limit = BLOCKVECTOR_NBLOCKS (bv) - 1;
! else
! limit = STATIC_BLOCK;
!
! for (i = GLOBAL_BLOCK; i <= limit; i++)
{
b = BLOCKVECTOR_BLOCK (bv, i);
/* Skip the sort if this block is always sorted. */
***************
*** 2336,2341 ****
--- 2390,2396 ----
}
}
}
+ }
}
prev_bv = bv;
}
Technical Details
Message-ID:
<9208132014.AA15945@citron.sw.stratus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!citron.sw.stratus.com!pfielandShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!citron.sw.stratus.com!pfieland From: pfieland@citron.sw.stratus.com (Peggy Fieland) Subject: (none) Message-ID: <9208132014.AA15945@citron.sw.stratus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 13 Aug 1992 20:14:49 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 159