* Error reading symbols...
@ 2000-04-27 14:21 Scott Bambrough
0 siblings, 0 replies; only message in thread
From: Scott Bambrough @ 2000-04-27 14:21 UTC (permalink / raw)
To: GDB Mailing List
Good day,
I get the following error when running a small dynamically linked test program:
"During symbol reading, register number 258 too large (max 26) in symbol buf.".
This error occurs in the following chunk of code when process_one_symbol is
passed a bogus value in nlist.n_value. It looks to me like the macro
INTERNALIZE_SYMBOL is the cause of the problem.
/* lines 1817 - 1831 from dbxread.c */
if (symbuf_idx == symbuf_end)
fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx++];
INTERNALIZE_SYMBOL (nlist, bufp, abfd);
OBJSTAT (objfile, n_stabs++);
type = bfd_h_get_8 (abfd, bufp->e_type);
SET_NAMESTRING ();
if (type & N_STAB)
{
process_one_symbol (type, nlist.n_desc, nlist.n_value,
namestring, section_offsets, objfile);
}
When the problem occurs GDB is processing the following stab:
"buf:r(0,44)=*(0,45)=ar(0,1);0;-1;(0,2)"
If I set a breakpoint on the complain() call in define_symbol I get the
following stack frame:
(top-gdb) bt
#0 define_symbol (valu=258, string=0x2 <Address 0x2 out of bounds>,
desc=1469, type=64, objfile=0x22d6bc0)
at ../../gdb-5.0/gdb/stabsread.c:1875
#1 0x020bc82c in process_one_symbol (type=64, desc=1469, valu=258,
name=0x2311ab3 "buf:r(0,44)=*(0,45)=ar(0,1);0;-1;(0,2)",
section_offsets=0x22fa678, objfile=0x22d6bc0)
at ../../gdb-5.0/gdb/dbxread.c:2402
#2 0x020bbd6c in read_ofile_symtab (pst=0x2320cdc)
at ../../gdb-5.0/gdb/dbxread.c:1829
#3 0xbffff304 in ?? ()
(top-gdb)
If I switch to frame #2 I have the following data values:
(top-gdb) p *bufp
$42 = {e_strx = "buf:", e_type = "r", e_other = "(", e_desc = "0,",
e_value = "44)="}
(top-gdb) p nlist
$43 = {n_strx = 24579, n_type = 64 '@', n_other = 0 '\000', n_desc = 1469,
n_value = 258}
I don't understand what is supposed to go on here. Given the values of the bufp
members and the definitions of INTERNALIZE_SYMBOL, bfd_h_32, and bfd_getl32
which follow I don't see how this should ever work.
The question is are the contents of bufp wrong or is the bfd_h_get_32 function
misbehaving? I suspect the former, but I'm not truly up to speed on the symbol
side of things in GDB. Can someone have a look and point me in the correct
direction?
/* macro from dbxread.c
#define INTERNALIZE_SYMBOL(intern, extern, abfd) \
{ \
(intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type); \
(intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx); \
(intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc); \
(intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value); \
}
/* from bfd-in2l.h and elf32-target.h */
bfd_h_get_32 == bfd_getl32
/* from libbfd.c */
bfd_vma
bfd_getl32 (addr)
register const bfd_byte *addr;
{
unsigned long v;
v = (unsigned long) addr[0];
v |= (unsigned long) addr[1] << 8;
v |= (unsigned long) addr[2] << 16;
v |= (unsigned long) addr[3] << 24;
return (bfd_vma) v;
}
Scott
--
Scott Bambrough - Software Engineer
REBEL.COM http://www.rebel.com
NetWinder http://www.netwinder.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-04-27 14:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-27 14:21 Error reading symbols Scott Bambrough
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).