From: David Carlton Date: Tue, 28 Jan 2003 00:33:13 +0000 (+0000) Subject: 2003-01-27 David Carlton X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=59d46c73607234c3d869393b03472a4283352b8e;p=thirdparty%2Fbinutils-gdb.git 2003-01-27 David Carlton * objfiles.h: Add comments about objfile->msymbols being NULL. * objfiles.c (objfile_relocate): Enclose ALL_OBJFILE_MSYMBOLS in guard. * i386-linux-tdep.c (find_minsym_and_objfile): Call ALL_MSYMBOLS instead of ALL_OBJFILES and ALL_OBJFILE_MSYMBOLS. * arm-linux-tdep.c (find_minsym_and_objfile): Ditto. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9735da008f6..682a91c155c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2003-01-27 David Carlton + + * objfiles.h: Add comments about objfile->msymbols being NULL. + * objfiles.c (objfile_relocate): Enclose ALL_OBJFILE_MSYMBOLS in + guard. + * i386-linux-tdep.c (find_minsym_and_objfile): Call ALL_MSYMBOLS + instead of ALL_OBJFILES and ALL_OBJFILE_MSYMBOLS. + * arm-linux-tdep.c (find_minsym_and_objfile): Ditto. + 2003-01-24 David Carlton * valops.c (find_oload_champ): New function. diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 627ed8dda47..a55fea94ad6 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -355,19 +355,15 @@ static struct minimal_symbol * find_minsym_and_objfile (char *name, struct objfile **objfile_p) { struct objfile *objfile; + struct minimal_symbol *msym; - ALL_OBJFILES (objfile) + ALL_MSYMBOLS (objfile, msym) { - struct minimal_symbol *msym; - - ALL_OBJFILE_MSYMBOLS (objfile, msym) + if (SYMBOL_NAME (msym) + && strcmp (SYMBOL_NAME (msym), name) == 0) { - if (SYMBOL_NAME (msym) - && strcmp (SYMBOL_NAME (msym), name) == 0) - { - *objfile_p = objfile; - return msym; - } + *objfile_p = objfile; + return msym; } } diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 1ef14fcb900..6dca390021c 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -322,19 +322,15 @@ static struct minimal_symbol * find_minsym_and_objfile (char *name, struct objfile **objfile_p) { struct objfile *objfile; + struct minimal_symbol *msym; - ALL_OBJFILES (objfile) + ALL_MSYMBOLS (objfile, msym) { - struct minimal_symbol *msym; - - ALL_OBJFILE_MSYMBOLS (objfile, msym) + if (SYMBOL_NAME (msym) + && STREQ (SYMBOL_NAME (msym), name)) { - if (SYMBOL_NAME (msym) - && STREQ (SYMBOL_NAME (msym), name)) - { - *objfile_p = objfile; - return msym; - } + *objfile_p = objfile; + return msym; } } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index c333f4cfd97..48e4bf52a4a 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -644,12 +644,15 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) } } - { - struct minimal_symbol *msym; - ALL_OBJFILE_MSYMBOLS (objfile, msym) - if (SYMBOL_SECTION (msym) >= 0) - SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym)); - } + if (objfile->msymbols != NULL) + { + struct minimal_symbol *msym; + ALL_OBJFILE_MSYMBOLS (objfile, msym) + if (SYMBOL_SECTION (msym) >= 0) + SYMBOL_VALUE_ADDRESS (msym) + += ANOFFSET (delta, SYMBOL_SECTION (msym)); + } + /* Relocating different sections by different amounts may cause the symbols to be out of order. */ msymbols_sort (objfile); diff --git a/gdb/objfiles.h b/gdb/objfiles.h index d472efc62c9..ea82a4166c3 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -300,6 +300,12 @@ struct objfile null symbol. The array itself, as well as all the data that it points to, should be allocated on the symbol_obstack for this file. */ + /* NOTE: carlton/2003-01-27: For a newly-created objfile, msymbols + is set to NULL, rather than a one-element array ending in a + null symbol. ALL_MSYMBOLS already guarded against that case, + so that seems to be a valid possibility; it can be useful if + you like to create artificial objfiles. */ + struct minimal_symbol *msymbols; int minimal_symbol_count; @@ -564,6 +570,10 @@ extern int is_in_import_list (char *, struct objfile *); /* Traverse all minimal symbols in one objfile. */ +/* NOTE: carlton/2003-01-27: Don't call this macro unless + objfile->msymbols is non-NULL. See NOTE above in the declaration + of 'struct objfile'. */ + #define ALL_OBJFILE_MSYMBOLS(objfile, m) \ for ((m) = (objfile) -> msymbols; SYMBOL_NAME(m) != NULL; (m)++)