summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-01-28 00:33:13 +0000
committerDavid Carlton <carlton@bactrian.org>2003-01-28 00:33:13 +0000
commit0fa1956a5be67f681c02552d1fcb56e9172999b6 (patch)
tree2f8b30250dff0872b203219b7449b8d2768d3e65
parent008196671dd92a0d31939a0e05b89e4fcada6e99 (diff)
downloadgdb-0fa1956a5be67f681c02552d1fcb56e9172999b6.tar.gz
2003-01-27 David Carlton <carlton@math.stanford.edu>
* 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.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/arm-linux-tdep.c16
-rw-r--r--gdb/i386-linux-tdep.c16
-rw-r--r--gdb/objfiles.c15
-rw-r--r--gdb/objfiles.h10
5 files changed, 40 insertions, 26 deletions
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 <carlton@math.stanford.edu>
+
+ * 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 <carlton@math.stanford.edu>
* 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)++)