This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: External debug symbols


Here comes a new patch that fixes some issues.

On Fri, 20 Sep 2002, Elena Zannoni wrote:

> Does the reread_symbols() function still work?  To see this you need
> to run the inferior, then w/o quitting from gdb, modify the
> executable/recompile and then issue a 'run' command.  That would cause
> the excutable and symbols to be reread.  It walks the list of existing
> objfiles and updates those that need it, but it doesn't call
> symbol_file_add, so the crc check would not be done and the 2 files
> could get out of sync.

I fixed reread_symbols so that it won't ever use an incorrect debug file. 
It doesn't do a full search though, so if you change the file and keep 
using separate debug files you better leave the debug file in the same 
place.
 
reread_symbols is pretty ugly in general though. For instance, what if the 
new file is relocated to a different place? It copies the old 
section_offsets, so that would break i think.

>  > diff --exclude '*~' --exclude '*.orig' --exclude '*.rej' --exclude '.#*' --exclude '*.o' --exclude CVS --exclude SCCS --exclude RCS --exclude '.*.flags' --exclude .cvsignore --exclude .depend -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	Mon Sep 16 13:15:15 2002
>  > @@ -409,6 +409,9 @@
>  >      ExportEntry *export_list;
>  >      int export_list_size;
>  >  
>  > +    struct objfile *separate_debug_objfile;
>  > +    struct objfile *separate_debug_objfile_backlink;
>  > +    
> 
> Could you add some comments, here and elsewhere?

I added some.

>  > +  debugfile = find_separate_debug_file (objfile, name);
>  > +  if (debugfile)
>  > +    {
>  > +      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);
> 
> 
> Suggest using a simple conditional instead of a conditional expression.

Done.

>  > +    };
>  > +  unsigned char *end;
>  > +
>  > +  crc = ~crc & 0xffffffff;
>  > +  for (end = buf + len; buf < end; ++buf)
>  > +    crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
>  > +  return ~crc & 0xffffffff;;
>  > +}
>  > +
> 
> I don't think this function belongs in this file. It is general enough
> that it could be pushed into utils.c. Maybe even into some directory
> outside of gdb? It could be useful to other tools as well.

Put it in utils.c
 
> For the below, in theory is Ok, but I would suggest looking at the
> function openp() (in source.c) and how it is used in the solib_open()
> function in solib.c.  The tricky part is going to be assuring that the
> filename is portable, i.e. working on windows/dos systems where the
> directory separator is '\'. Look at IS_DIR_SEPARATOR, IS_ABSOLUTE_PATH
> in the libiberty directory.

I don't want to use openp() because i don't want the first availible file. 
I want the first one that matches the checksum. I can't see how i can use 
openp() to accomplish that.
 
> Once this is done, this change would need to be documented in the gdb
> manual, and a testcase added to the testsuite.

I really tried to make a testcase. I promise. I was just completely 
crushed by expect/dejagnu and the testsuite setup. I have a small piece of 
code that can be used with objcopy --add-section to generate a 
.gnu_debuglink section to test this. I tried it manually, and it works 
well. If anyone is willing to do the testsuite work I promise to help as 
much as I can.

--
--------------------------------------------------------------------------
 Alexander Larsson                                            Red Hat, Inc 
                   alexl@redhat.com    alla@lysator.liu.se 
He's an otherworldly drug-addicted firefighter trapped in a world he never 
made. She's a cynical Buddhist museum curator with the power to see death. 
They fight crime! 

Attachment: gdb_debug2.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]