Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Darwin: add OSO as separate debug files
@ 2010-01-05 11:32 Tristan Gingold
  2010-01-06 19:19 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Tristan Gingold @ 2010-01-05 11:32 UTC (permalink / raw)
  To: gdb-patches

Hi,

in order to correctly handle Darwin OSO files, they are now added as
separate debug objfile.

This is the Darwin specific use of the previous patch.

Tristan.

2009-12-23  Tristan Gingold  <gingold@adacore.com>

	* machoread.c (macho_add_oso_symfile): Add symfile_flags parameter.
	Call xstrdup for abfd->filename.  Pass symfile_flags and objfile flags
	to symbol_file_add_from_bfd.  Add OSO as separate objfile.
	(macho_oso_symfile): Add symfile_flags parameter.  Pass it to
	macho_add_oso_symfile.
	(macho_symfile_read): Pass symfile_flags to macho_oso_symfile.
---
 gdb/machoread.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gdb/machoread.c b/gdb/machoread.c
index 81f60ec..534fc94 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -292,8 +292,10 @@ oso_el_compare_name (const void *vl, const void *vr)
 /* Add an oso file as a symbol file.  */
 
 static void
-macho_add_oso_symfile (oso_el *oso, bfd *abfd, struct objfile *main_objfile)
+macho_add_oso_symfile (oso_el *oso, bfd *abfd,
+                       struct objfile *main_objfile, int symfile_flags)
 {
+  struct objfile *objfile;
   struct section_addr_info *addrs;
   int len;
   int i;
@@ -363,13 +365,22 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, struct objfile *main_objfile)
                            addrs->other[j].name);
     }
 
-  symbol_file_add_from_bfd (abfd, 0, addrs, 0);
+  /* Make sure that the filename was malloc'ed.  The current filename comes
+     either from an OSO symbol name or from an archive name.  Memory for both
+     is not managed by gdb.  */
+  abfd->filename = xstrdup (abfd->filename);
+
+  objfile = symbol_file_add_from_bfd
+    (abfd, symfile_flags, addrs,
+     main_objfile->flags & (OBJF_REORDERED | OBJF_SHARED
+                            | OBJF_READNOW | OBJF_USERLOADED));
+  add_separate_debug_objfile (objfile, main_objfile);
 }
 
 /* Read symbols from the vector of oso files.  */
 
 static void
-macho_oso_symfile (struct objfile *main_objfile)
+macho_oso_symfile (struct objfile *main_objfile, int symfile_flags)
 {
   int ix;
   VEC (oso_el) *vec;
@@ -453,7 +464,8 @@ macho_oso_symfile (struct objfile *main_objfile)
                       && !memcmp (member_name, oso2->name + pfx_len + 1,
                                   member_len))
                     {
-                      macho_add_oso_symfile (oso2, member_bfd, main_objfile);
+                      macho_add_oso_symfile (oso2, member_bfd,
+                                             main_objfile, symfile_flags);
                       oso2->name = NULL;
                       break;
                     }
@@ -486,7 +498,7 @@ macho_oso_symfile (struct objfile *main_objfile)
             warning (_("`%s': can't open to read symbols: %s."), oso->name,
                      bfd_errmsg (bfd_get_error ()));
           else
-            macho_add_oso_symfile (oso, abfd, main_objfile);
+            macho_add_oso_symfile (oso, abfd, main_objfile, symfile_flags);
 
           ix++;
         }
@@ -670,7 +682,7 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags)
 
   /* Then the oso.  */
   if (oso_vector != NULL)
-    macho_oso_symfile (objfile);
+    macho_oso_symfile (objfile, symfile_flags);
 }
 
 static void
-- 
1.6.5.rc2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] Darwin: add OSO as separate debug files
  2010-01-05 11:32 [RFC] Darwin: add OSO as separate debug files Tristan Gingold
@ 2010-01-06 19:19 ` Tom Tromey
  2010-01-07  9:05   ` Tristan Gingold
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-01-06 19:19 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: gdb-patches

>>>>> "Tristan" == Tristan Gingold <gingold@ACT-Europe.FR> writes:

Tristan> in order to correctly handle Darwin OSO files, they are now added as
Tristan> separate debug objfile.
Tristan> This is the Darwin specific use of the previous patch.

I read through this and didn't see anything obviously objectionable.
I don't know anything about Darwin, though, so I think you will have to
self-approve.

Tom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] Darwin: add OSO as separate debug files
  2010-01-06 19:19 ` Tom Tromey
@ 2010-01-07  9:05   ` Tristan Gingold
  2010-01-14 12:48     ` Tristan Gingold
  0 siblings, 1 reply; 4+ messages in thread
From: Tristan Gingold @ 2010-01-07  9:05 UTC (permalink / raw)
  To: tromey; +Cc: Tristan Gingold, gdb-patches


On Jan 6, 2010, at 8:18 PM, Tom Tromey wrote:

>>>>>> "Tristan" == Tristan Gingold <gingold@ACT-Europe.FR> writes:
> 
> Tristan> in order to correctly handle Darwin OSO files, they are now added as
> Tristan> separate debug objfile.
> Tristan> This is the Darwin specific use of the previous patch.
> 
> I read through this and didn't see anything obviously objectionable.
> I don't know anything about Darwin, though, so I think you will have to
> self-approve.

Thanks.
Tristan.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] Darwin: add OSO as separate debug files
  2010-01-07  9:05   ` Tristan Gingold
@ 2010-01-14 12:48     ` Tristan Gingold
  0 siblings, 0 replies; 4+ messages in thread
From: Tristan Gingold @ 2010-01-14 12:48 UTC (permalink / raw)
  To: gdb-patches ml


On Jan 7, 2010, at 10:06 AM, Tristan Gingold wrote:

> 
> On Jan 6, 2010, at 8:18 PM, Tom Tromey wrote:
> 
>>>>>>> "Tristan" == Tristan Gingold <gingold@ACT-Europe.FR> writes:
>> 
>> Tristan> in order to correctly handle Darwin OSO files, they are now added as
>> Tristan> separate debug objfile.
>> Tristan> This is the Darwin specific use of the previous patch.
>> 
>> I read through this and didn't see anything obviously objectionable.
>> I don't know anything about Darwin, though, so I think you will have to
>> self-approve.
> 
> Thanks.

and committed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-14 12:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-05 11:32 [RFC] Darwin: add OSO as separate debug files Tristan Gingold
2010-01-06 19:19 ` Tom Tromey
2010-01-07  9:05   ` Tristan Gingold
2010-01-14 12:48     ` Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox