aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index 9136daa..c5c54db 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -47,6 +47,7 @@
#include "cp-support.h"
#include "disasm.h"
#include "inline-frame.h"
+#include "linespec.h"
#include "gdb_assert.h"
#include <ctype.h>
@@ -2444,20 +2445,25 @@ func_command (char *arg, int from_tty)
int i;
int level = 1;
struct function_bounds *func_bounds = NULL;
+ struct cleanup *cleanups;
if (arg != NULL)
return;
frame = parse_frame_specification ("0");
- sals = decode_line_spec (arg, 1);
+ sals = decode_line_spec (arg, DECODE_LINE_FUNFIRSTLINE);
+ cleanups = make_cleanup (xfree, sals.sals);
func_bounds = (struct function_bounds *) xmalloc (
sizeof (struct function_bounds) * sals.nelts);
+ make_cleanup (xfree, func_bounds);
for (i = 0; (i < sals.nelts && !found); i++)
{
- if (sals.sals[i].pc == 0
- || find_pc_partial_function (sals.sals[i].pc, NULL,
- &func_bounds[i].low,
- &func_bounds[i].high) == 0)
+ if (sals.sals[i].pspace != current_program_space)
+ func_bounds[i].low = func_bounds[i].high = 0;
+ else if (sals.sals[i].pc == 0
+ || find_pc_partial_function (sals.sals[i].pc, NULL,
+ &func_bounds[i].low,
+ &func_bounds[i].high) == 0)
{
func_bounds[i].low = func_bounds[i].high = 0;
}
@@ -2476,8 +2482,7 @@ func_command (char *arg, int from_tty)
}
while (!found && level == 0);
- if (func_bounds)
- xfree (func_bounds);
+ do_cleanups (cleanups);
if (!found)
printf_filtered (_("'%s' not within current stack frame.\n"), arg);