aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1995-10-24 21:22:56 +0000
committerStu Grossman <grossman@cygnus>1995-10-24 21:22:56 +0000
commit3f687c7896795bac80f4e2e15f565562f34b4e30 (patch)
treeadbadb7834dc6daf11650767e4f4a2ef85097906 /gdb/symtab.c
parent43b428a7bf92c725de4d5560807cd0a4682c0962 (diff)
downloadgdb-3f687c7896795bac80f4e2e15f565562f34b4e30.zip
gdb-3f687c7896795bac80f4e2e15f565562f34b4e30.tar.gz
gdb-3f687c7896795bac80f4e2e15f565562f34b4e30.tar.bz2
* infrun.c (wait_for_inferior): Disable questionable code near
the step range test. Replace call detection test with much simpler (and more efficient) test that doesn't require prologue examination (as often). * symtab.c symtab.h (in_prologue): New function that indicates whether or not we are in a function prologue. This uses the symbol table, and then falls back to prologue examination if that fails. It's much more efficient for remote debugging because it avoids examining memory, which is very slow. This is used in wait_for_inferior to determine if we've made a function call that needs to be skipped over (for next/nexti). * mips-tdep.c (after_prologue): New function, returns the PC after the prologue. Uses PDRs and the symbol table. (mips_find_saved_regs): Use in_prologue() to avoid costly prologue examination if possible. (mips_skip_prologue): Use after_prologue() if possible to avoid costly prologue examination.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a0337e3..fa3d2e5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2874,7 +2874,7 @@ list_symbols (regexp, class, bpt, from_tty)
if (bpt)
{
break_command (SYMBOL_NAME (msymbol), from_tty);
- printf_filtered ("<function, no debug info>%s;\n",
+ printf_filtered ("<function, no debug info> %s;\n",
SYMBOL_SOURCE_NAME (msymbol));
continue;
}
@@ -3240,6 +3240,51 @@ make_symbol_completion_list (text, word)
return (return_val);
}
+/* Determine if PC is in the prologue of a function. The prologue is the area
+ between the first instruction of a function, and the first executable line.
+ Returns 1 if PC *might* be in prologue, 0 if definately *not* in prologue.
+ */
+
+int
+in_prologue (pc, func_start)
+ CORE_ADDR pc;
+ CORE_ADDR func_start;
+{
+ struct symtab_and_line sal;
+ CORE_ADDR func_addr, func_end;
+
+ if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+ goto nosyms; /* Might be in prologue */
+
+ sal = find_pc_line (func_addr, 0);
+
+ if (sal.line == 0)
+ goto nosyms;
+
+ if (sal.end > func_addr
+ && sal.end <= func_end) /* Is prologue in function? */
+ return pc < sal.end; /* Yes, is pc in prologue? */
+
+ /* The line after the prologue seems to be outside the function. In this
+ case, tell the caller to find the prologue the hard way. */
+
+ return 1;
+
+/* Come here when symtabs don't contain line # info. In this case, it is
+ likely that the user has stepped into a library function w/o symbols, or
+ is doing a stepi/nexti through code without symbols. */
+
+ nosyms:
+
+/* We need to call the target-specific prologue skipping functions with the
+ function's start address because PC may be pointing at an instruction that
+ could be mistakenly considered part of the prologue. */
+
+ SKIP_PROLOGUE (func_start);
+
+ return pc < func_start;
+}
+
void
_initialize_symtab ()