aboutsummaryrefslogtreecommitdiff
path: root/gdb/blockframe.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1993-10-07 16:42:08 +0000
committerStu Grossman <grossman@cygnus>1993-10-07 16:42:08 +0000
commit981a33093328ee54fb095007f733bea3a1dbe5bf (patch)
treea112c9116c617c2ef5df57b4985fb22d9dd27f6e /gdb/blockframe.c
parent50a540397837c7239b39a9100a5ed6a5813593e3 (diff)
downloadgdb-981a33093328ee54fb095007f733bea3a1dbe5bf.zip
gdb-981a33093328ee54fb095007f733bea3a1dbe5bf.tar.gz
gdb-981a33093328ee54fb095007f733bea3a1dbe5bf.tar.bz2
* blockframe.c (find_pc_partial_function): Fix handling for PCs
beyond the end of the last function in an objfile. * coff-solib.c (coff_solib_add): Use BFD to get fields from .lib section. * infrun.c (wait_for_inferior): Modify test for subroutine entry to include pc out of bounds of the previous function. * remote.c (remote_wait): Use strtoul for parsing 'N' message. Add code to relocate symfile_objfile->sections.
Diffstat (limited to 'gdb/blockframe.c')
-rw-r--r--gdb/blockframe.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 7acbf6a..0d0e89a 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -624,6 +624,7 @@ find_pc_partial_function (pc, name, address, endaddr)
struct symbol *f;
struct minimal_symbol *msymbol;
struct partial_symbol *psb;
+ struct obj_section *sec;
if (pc >= cache_pc_function_low && pc < cache_pc_function_high)
goto return_cached_value;
@@ -688,6 +689,16 @@ find_pc_partial_function (pc, name, address, endaddr)
}
}
+ /* Not in the normal symbol tables, see if the pc is in a known section.
+ If it's not, then give up. This ensures that anything beyond the end
+ of the text seg doesn't appear to be part of the last function in the
+ text segment. */
+
+ sec = find_pc_section (pc);
+
+ if (!sec)
+ msymbol = NULL;
+
/* Must be in the minimal symbol table. */
if (msymbol == NULL)
{
@@ -701,40 +712,26 @@ find_pc_partial_function (pc, name, address, endaddr)
return 0;
}
- /* I believe the purpose of this check is to make sure that anything
- beyond the end of the text segment does not appear as part of the
- last function of the text segment. It assumes that there is something
- other than a mst_text symbol after the text segment. It is broken in
- various cases, so anything relying on this behavior (there might be
- some places) should be using find_pc_section or some such instead. */
+ /* See if we're in a transfer table for Sun shared libs. */
+
if (msymbol -> type == mst_text)
cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol);
else
/* It is a transfer table for Sun shared libraries. */
cache_pc_function_low = pc - FUNCTION_START_OFFSET;
+
cache_pc_function_name = SYMBOL_NAME (msymbol);
- if (SYMBOL_NAME (msymbol + 1) != NULL)
- /* This might be part of a different segment, which might be a bad
- idea. Perhaps we should be using the smaller of this address or the
- endaddr from find_pc_section. */
+ /* Use the lesser of the next minimal symbol, or the end of the section, as
+ the end of the function. */
+
+ if (SYMBOL_NAME (msymbol + 1) != NULL
+ && SYMBOL_VALUE_ADDRESS (msymbol + 1) < sec->endaddr)
cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + 1);
else
- {
- /* We got the start address from the last msymbol in the objfile.
- So the end address is the end of the section. */
- struct obj_section *sec;
-
- sec = find_pc_section (pc);
- if (sec == NULL)
- {
- /* Don't know if this can happen but if it does, then just say
- that the function is 1 byte long. */
- cache_pc_function_high = cache_pc_function_low + 1;
- }
- else
- cache_pc_function_high = sec->endaddr;
- }
+ /* We got the start address from the last msymbol in the objfile.
+ So the end address is the end of the section. */
+ cache_pc_function_high = sec->endaddr;
return_cached_value:
if (address)