Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Alexander Larsson <alexl@redhat.com>
To: gdb@sources.redhat.com
Subject: Re: External debug symbols
Date: Wed, 21 Aug 2002 06:39:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0208210917270.12684-200000@devserv.devel.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0208201535320.12684-200000@devserv.devel.redhat.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 607 bytes --]

On Tue, 20 Aug 2002, Alexander Larsson wrote:

> It seems to work for
> the main binary, but setting breakpoints in libraries doesn't work. I
> think it gets the base address wrong or something.

The new patch attached seems to fix this.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl@redhat.com    alla@lysator.liu.se 
He's an otherworldly vegetarian librarian looking for 'the Big One.' She's a 
hard-bitten renegade pearl diver with a flame-thrower. They fight crime! 

[-- Attachment #2: Type: TEXT/PLAIN, Size: 2799 bytes --]

diff -ur gdb-5.2.1/gdb/objfiles.c gdb-5.2.1.separate_debug_symbols/gdb/objfiles.c
--- gdb-5.2.1/gdb/objfiles.c	Thu Dec  6 21:59:11 2001
+++ gdb-5.2.1.separate_debug_symbols/gdb/objfiles.c	Tue Aug 20 15:32:15 2002
@@ -397,6 +397,11 @@
 void
 free_objfile (struct objfile *objfile)
 {
+  if (objfile->separate_debug_objfile)
+    {
+      free_objfile (objfile->separate_debug_objfile);
+    }
+  
   /* First do any symbol file specific actions required when we are
      finished with a particular symbol file.  Note that if the objfile
      is using reusable symbol information (via mmalloc) then each of
diff -ur gdb-5.2.1/gdb/objfiles.h gdb-5.2.1.separate_debug_symbols/gdb/objfiles.h
--- gdb-5.2.1/gdb/objfiles.h	Sat Jun 29 00:05:47 2002
+++ gdb-5.2.1.separate_debug_symbols/gdb/objfiles.h	Tue Aug 20 15:15:56 2002
@@ -409,6 +409,8 @@
     ExportEntry *export_list;
     int export_list_size;
 
+    struct objfile *separate_debug_objfile;
+    
     /* Place to stash various statistics about this objfile */
       OBJSTATS;
   };
diff -ur gdb-5.2.1/gdb/symfile.c gdb-5.2.1.separate_debug_symbols/gdb/symfile.c
--- gdb-5.2.1/gdb/symfile.c	Sat Jun 22 18:49:33 2002
+++ gdb-5.2.1.separate_debug_symbols/gdb/symfile.c	Wed Aug 21 14:47:49 2002
@@ -837,6 +837,11 @@
   struct objfile *objfile;
   struct partial_symtab *psymtab;
   bfd *abfd;
+  asection *sect = NULL;
+  struct section_addr_info orig_addrs;
+  
+  if (addrs)
+    orig_addrs = *addrs;
 
   /* Open a bfd for the file, and give user a chance to burp if we'd be
      interactively wiping out any existing symbols.  */
@@ -926,6 +931,43 @@
   if (target_new_objfile_hook)
     target_new_objfile_hook (objfile);
 
+  
+  sect = bfd_get_section_by_name (objfile->obfd, ".debuglink");
+  if (sect)
+    {
+      bfd_size_type size = bfd_section_size (objfile->obfd, sect);
+      char *debuglink;
+      char *dir;
+      char *debugfile;
+      char *name_copy;
+      char *p;
+      
+      debuglink = alloca (size);
+      bfd_get_section_contents (objfile->obfd, sect, debuglink,
+				(file_ptr)0, (bfd_size_type)size);
+
+      dir = xstrdup (name);
+      p = strrchr (dir, '/');
+      if (p != NULL)
+	{
+	  *(p+1) = 0;
+	  
+	  debugfile = alloca ( strlen (dir) + strlen (debuglink) + 1);
+	  strcpy (debugfile, dir);
+	  strcat (debugfile, debuglink);
+	}
+      else
+	{
+	  debugfile = alloca ( strlen (debuglink) + 1);
+	  strcpy (debugfile, debuglink);
+	}
+      xfree (dir);
+      
+      printf_filtered ("loading separate debug info from '%s'\n", debugfile);
+
+      objfile->separate_debug_objfile = symbol_file_add (debugfile, from_tty, (addrs != NULL) ? &orig_addrs : NULL, 0, flags);
+    }
+  
   return (objfile);
 }
 

  reply	other threads:[~2002-08-21 13:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-20 12:50 Alexander Larsson
2002-08-21  6:39 ` Alexander Larsson [this message]
2002-08-21 10:46 ` Jim Blandy
2002-08-21 23:51   ` Alexander Larsson
2002-08-27  3:59   ` Alexander Larsson
2002-09-16  6:59     ` Alexander Larsson
2002-09-20  8:13       ` Elena Zannoni
2002-09-20  8:22         ` Daniel Jacobowitz
2002-09-23  0:46           ` Alexander Larsson
2002-09-23  0:43         ` Alexander Larsson
2002-09-23  8:21         ` Alexander Larsson
2002-09-23  8:25           ` Daniel Jacobowitz
2002-09-23 10:03             ` Alexander Larsson
2002-09-23 21:45           ` Eli Zaretskii
2002-09-25  1:51             ` Alexander Larsson
2002-09-25 22:00               ` Eli Zaretskii
2002-10-02  7:42                 ` Alexander Larsson
2002-10-02 21:40                   ` Eli Zaretskii
2002-10-08  8:21                     ` Alexander Larsson
2002-10-08  9:33                       ` Eli Zaretskii

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=Pine.LNX.4.44.0208210917270.12684-200000@devserv.devel.redhat.com \
    --to=alexl@redhat.com \
    --cc=gdb@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