From: David Carlton <carlton@math.stanford.edu>
To: gdb <gdb@sources.redhat.com>
Cc: per@bothner.com, green@redhat.com
Subject: allocate_objfile (NULL, 0)
Date: Thu, 21 Nov 2002 16:47:00 -0000 [thread overview]
Message-ID: <ro18yzmh1mh.fsf@jackfruit.Stanford.EDU> (raw)
I'm in a situation where I want to create an artificial block to store
some artificial symbols. I've followed the lead of jv-lang.c (which
needs a block to store symbols associated to dynamic classes); that
code creates an object file via this call:
dynamics_objfile = allocate_objfile (NULL, 0);
and then creates a symtab within it, creates global and static blocks
for that symtab, and stuffs stuff into the global block.
The problem with this is that the resulting objfile doesn't have a
name, and there is code within GDB that assumes that objfile->name is
non-NULL. I ran into this problem in solib.c's symbol_add_stub, but
there may well be other places that make that assumption.
So something should be fixed. It seems that the three possible
options are:
1) Not allow code to assume that objfile->name is always non-NULL.
2) Modify allocate_objfile to set the allocated objfile's name to the
empty string in the case where its first argument is NULL.
3) Fix jv-lang.c to set objfile->name explicitly.
I'll be happy to submit a patch that does one of these, but I wanted
to poll people to see which option they prefer. My vote is for option
number 2: the code in solib.c seems reasonable enough, so I don't like
option number 1, and allocate_objfile seems to go to some length to
work well when its first argument is NULL, so it wouldn't hurt for it
to handle this issue as well. It would, of course, be possible to do
both options 2 and 3: assuming that we agree that option 2 is good,
then it would be up to the Java maintainers as to whether they wanted
to follow option 3 as well.
David Carlton
carlton@math.stanford.edu
next reply other threads:[~2002-11-22 0:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-21 16:47 David Carlton [this message]
2002-11-21 17:57 ` Per Bothner
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=ro18yzmh1mh.fsf@jackfruit.Stanford.EDU \
--to=carlton@math.stanford.edu \
--cc=gdb@sources.redhat.com \
--cc=green@redhat.com \
--cc=per@bothner.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