From: Jim Blandy <jimb@zenia.red-bean.com>
To: david carlton <carlton@math.stanford.edu>
Cc: gdb-patches@sources.redhat.com
Subject: Re: dwarf2_build_psymtabs should check that .debug_line exists
Date: Tue, 13 Aug 2002 13:50:00 -0000 [thread overview]
Message-ID: <vt24rdyze50.fsf@zenia.red-bean.com> (raw)
In-Reply-To: <15697.45810.578860.108712@jackfruit.Stanford.EDU>
david carlton <carlton@math.stanford.edu> writes:
> I was reading through dwarf2read.c when I noticed that
> dwarf2_build_psymtabs() doesn't check to see if the file that you're
> debugging has a .debug_line section before initializing
> dwarf_line_buffer. This is potentially unfortunate:
> dwarf2_build_psymtabs() is called when dwarf2_has_info() returns 1,
> but dwarf2_has_info() only checks to see if the file that you're
> debugging has .debug_info and .debug_abbrev sections.
>
> It is, of course, quite rare for a file to have .debug_info and
> .debug_abbrev sections but not to have a .debug_line section; so,
> obviously this isn't a serious problem. And, even if you produce such
> a file (using objcopy -R .debug_line, say), it's still pretty hard to
> cause GDB to signal an error, but with some effort I did manage to do
> so. (I can submit a PR with details, if anybody wants.) Given that
> dwarf2_build_psymtabs() is careful to make sure all the other
> .debug_XXX sections exist, it should certainly also check to make sure
> that .debug_line exists.
>
> By the way, I checked to see where the contents of the .debug_line
> section are used; as far as I can tell, it's only used in
> dwarf2read.c(dwarf_decode_line_header), and that function does have a
> check in it to make sure that dwarf_line_buffer is non-NULL. So this
> fix is probably better than the other obvious fix, namely to have
> dwarf2_has_info() ensure that the file has a .debug_line section.
Yes, this all makes good sense.
Well, dwarf_decode_line_header stashes pointers into the
debug_line_buffer in the struct line_header it returns. So
dwarf_decode_lines uses dwarf_line_buffer, too.
It looks to me like read_file_scope shouldn't call dwarf_decode_macros
either when line_header is zero. Could you add that to your patch,
and re-post it?
next prev parent reply other threads:[~2002-08-13 20:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-07 16:53 david carlton
2002-08-13 13:50 ` Jim Blandy [this message]
2002-08-13 14:54 ` David Carlton
2002-08-14 16:47 ` Jim Blandy
2002-08-19 16:43 ` David Carlton
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=vt24rdyze50.fsf@zenia.red-bean.com \
--to=jimb@zenia.red-bean.com \
--cc=carlton@math.stanford.edu \
--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