From: Joel Brobecker <brobecker@ACT-Europe.FR>
To: Elena Zannoni <ezannoni@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch] Fix uninitialized section index internal error
Date: Tue, 06 Nov 2001 07:40:00 -0000 [thread overview]
Message-ID: <20011115075241.A26308@act-europe.fr> (raw)
In-Reply-To: <20010615084043.E10731@act-europe.fr>; from brobecker@act-europe.fr on Fri, Jun 15, 2001 at 08:40:43AM +0200
Hi Elena,
I finally had some time to look at the problem we encounter on Tru64
5.1... It's been a long sime since we last discussed this, so here is
a pointer to the original message:
http://sources.redhat.com/ml/gdb-patches/2001-05/msg00187.html
I can actually reproduce the internal error with an empty program
without needing to link in libmach.so...
So, I modified mdebugread.c to separate the handling of symbols
located in the BSS section and the symbols located in the SBSS section,
just as you suggested. I thought that would make the internal-error
disappear, but they did not :-(.
After investigating a bit more, I found that the linker creates a
certain number of special symbols, such as _ebss, or _fdata for
instance. The Compacq documentation says that all these symbols are
labels. These labels are used as adresses to mark the begining or the
end of a particular part of the an object file. For instance, _ebss
marks the end of the .bss section.
The "trick" that confuses gdb in our example is that the symbol
table in the executable contains an entry for the "_ebss" symbol, which
storage class is scBss (and I verified this with the native odump
utility). However, the .bss section does not exist! This is not the only
symbol that is causing trouble, others are in a similar case. I noticed
that the problem arrises with the .data section when we try to load the
symbols of /usr/shlib/libm.so, for instance.
So it appears that having a symbol referencing a section does not
necessarily means that this section actually exists, not for Label
symbols. I'm not sure how to fix this in GDB. I can see several options.
The solution that seems the most reasonable to me is to check whether
the section exists before making the address of the Label symbol relative to
the section start address. Otherwise, if the symbol refers to a
non-existent section, then keep the address as-is and set the storage
class to "unknown". This seems a bit "hacky" to me, because we are
not being very consistant on how we consider the address of the label
(relative or not relative, that is the question).
Another approach, which has the merit of simplifying the code (maybe
a bit too much) is to say: all label addresses are absolute, and we
don't really care which section they are refering to. So the whole
stLabel case code-section collapses to the following line:
ms_type = mst_unknown;
/* value is already set to ext_in->asym.value */
I find this approach quite attractive, but I am afraid that it might be
a bit too simplistic to be correct...
Let me know what you think,
Thanks.
--
Joel
prev parent reply other threads:[~2001-11-15 6:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-10 14:40 Joel Brobecker
2001-06-12 14:18 ` Elena Zannoni
2001-06-14 23:40 ` Joel Brobecker
2001-06-27 22:32 ` Elena Zannoni
2001-06-28 5:23 ` Joel Brobecker
2001-06-28 20:17 ` Elena Zannoni
2001-11-06 7:40 ` Joel Brobecker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011115075241.A26308@act-europe.fr \
--to=brobecker@act-europe.fr \
--cc=ezannoni@cygnus.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox