Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: David Carlton <carlton@math.stanford.edu>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: gdb-patches@sources.redhat.com, Tom Tromey <tromey@redhat.com>
Subject: Re: [rfa] allocate_objfile(NULL, 0)
Date: Tue, 04 Feb 2003 22:21:00 -0000	[thread overview]
Message-ID: <ro1n0lb3du6.fsf@jackfruit.Stanford.EDU> (raw)
In-Reply-To: <15936.437.642918.181857@localhost.redhat.com>

On Tue, 4 Feb 2003 13:08:53 -0500, Elena Zannoni <ezannoni@redhat.com> said:

> I cannot come up with anything better at the moment, so OK, but...
> could you add comments? Kind of summarize your mail and Tom's mail.

Okay, I've added comments at the beginning of allocate_objfile and at
its caller in the Java code mentioning the situation.  I've committed
the attached; I also committed it to 5.3, on the off chance that 5.3.1
ever happens.

David Carlton
carlton@math.stanford.edu

2003-02-04  David Carlton  <carlton@math.stanford.edu>

	* objfiles.c (allocate_objfile): Always set name.  Add comment at
	start of function.
	* jv-lang.c (get_dynamics_objfile): Add comment.

Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.26
diff -u -p -r1.26 objfiles.c
--- objfiles.c	4 Feb 2003 18:07:01 -0000	1.26
+++ objfiles.c	4 Feb 2003 21:52:59 -0000
@@ -150,6 +150,15 @@ build_objfile_section_table (struct objf
    OBJF_SHARED are simply copied through to the new objfile flags
    member. */
 
+/* NOTE: carlton/2003-02-04: This function is called with args NULL, 0
+   by jv-lang.c, to create an artificial objfile used to hold
+   information about dynamically-loaded Java classes.  Unfortunately,
+   that branch of this function doesn't get tested very frequently, so
+   it's prone to breakage.  (E.g. at one time the name was set to NULL
+   in that situation, which broke a loop over all names in the dynamic
+   library loader.)  If you change this function, please try to leave
+   things in a consistent state even if abfd is NULL.  */
+
 struct objfile *
 allocate_objfile (bfd *abfd, int flags)
 {
@@ -312,6 +321,10 @@ allocate_objfile (bfd *abfd, int flags)
 	  error ("Can't find the file sections in `%s': %s",
 		 objfile->name, bfd_errmsg (bfd_get_error ()));
 	}
+    }
+  else
+    {
+      objfile->name = "<<anonymous objfile>>";
     }
 
   /* Initialize the section indexes for this objfile, so that we can
Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.12
diff -u -p -r1.12 jv-lang.c
--- jv-lang.c	11 Jul 2002 20:46:19 -0000	1.12
+++ jv-lang.c	4 Feb 2003 21:53:04 -0000
@@ -68,6 +68,12 @@ static struct objfile *dynamics_objfile 
 
 static struct type *java_link_class_type (struct type *, struct value *);
 
+/* FIXME: carlton/2003-02-04: This is the main or only caller of
+   allocate_objfile with first argument NULL; as a result, this code
+   breaks every so often.  Somebody should write a test case that
+   exercises GDB in various ways (e.g. something involving loading a
+   dynamic library) after this code has been called.  */
+
 static struct objfile *
 get_dynamics_objfile (void)
 {


      reply	other threads:[~2003-02-04 22:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-10 23:41 David Carlton
2003-01-11  0:00 ` Elena Zannoni
2003-01-11  0:12   ` David Carlton
2003-01-17 23:32     ` Tom Tromey
2003-02-04 18:02       ` Elena Zannoni
2003-02-04 18:07         ` Tom Tromey
2003-02-04 18:04     ` Elena Zannoni
2003-02-04 22:21       ` David Carlton [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=ro1n0lb3du6.fsf@jackfruit.Stanford.EDU \
    --to=carlton@math.stanford.edu \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=tromey@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