gdb/ChangeLog:
* stack.c (get_selected_block): Add new argument `addr_in_block', used to return the exact code address we used to select the block, not just the block. * blockframe.c (get_frame_block, get_current_block): Same. * frame.h (get_frame_block, get_current_block, get_selected_block): Update declarations. * linespec.c, stack.c, blockframe.c, breakpoint.c, findvar.c, linespec.c, varobj.c, printcmd.c, symtab.c: Callers changed. gdb/mi/ChangeLog: * mi-cmd-stack.c (list_args_or_locals): Pass new arg to get_frame_block. (See entry in gdb/ChangeLog.)
This commit is contained in:
parent
84d2ac95e4
commit
ae767bfb78
13 changed files with 68 additions and 25 deletions
|
@ -1,3 +1,14 @@
|
|||
2002-03-29 Jim Blandy <jimb@redhat.com>
|
||||
|
||||
* stack.c (get_selected_block): Add new argument `addr_in_block',
|
||||
used to return the exact code address we used to select the block,
|
||||
not just the block.
|
||||
* blockframe.c (get_frame_block, get_current_block): Same.
|
||||
* frame.h (get_frame_block, get_current_block,
|
||||
get_selected_block): Update declarations.
|
||||
* linespec.c, stack.c, blockframe.c, breakpoint.c, findvar.c,
|
||||
linespec.c, varobj.c, printcmd.c, symtab.c: Callers changed.
|
||||
|
||||
2002-04-05 Michael Snyder <msnyder@redhat.com>
|
||||
|
||||
* breakpoint.c (insert_breakpoints): Change 'hw' to 'hardware in
|
||||
|
|
|
@ -504,10 +504,23 @@ get_frame_saved_regs (struct frame_info *frame,
|
|||
#endif
|
||||
|
||||
/* Return the innermost lexical block in execution
|
||||
in a specified stack frame. The frame address is assumed valid. */
|
||||
in a specified stack frame. The frame address is assumed valid.
|
||||
|
||||
If ADDR_IN_BLOCK is non-zero, set *ADDR_IN_BLOCK to the exact code
|
||||
address we used to choose the block. We use this to find a source
|
||||
line, to decide which macro definitions are in scope.
|
||||
|
||||
The value returned in *ADDR_IN_BLOCK isn't necessarily the frame's
|
||||
PC, and may not really be a valid PC at all. For example, in the
|
||||
caller of a function declared to never return, the code at the
|
||||
return address will never be reached, so the call instruction may
|
||||
be the very last instruction in the block. So the address we use
|
||||
to choose the block is actually one byte before the return address
|
||||
--- hopefully pointing us at the call instruction, or its delay
|
||||
slot instruction. */
|
||||
|
||||
struct block *
|
||||
get_frame_block (struct frame_info *frame)
|
||||
get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block)
|
||||
{
|
||||
CORE_ADDR pc;
|
||||
|
||||
|
@ -520,13 +533,22 @@ get_frame_block (struct frame_info *frame)
|
|||
after the call insn, we probably want to make frame->pc point after
|
||||
the call insn anyway. */
|
||||
--pc;
|
||||
|
||||
if (addr_in_block)
|
||||
*addr_in_block = pc;
|
||||
|
||||
return block_for_pc (pc);
|
||||
}
|
||||
|
||||
struct block *
|
||||
get_current_block (void)
|
||||
get_current_block (CORE_ADDR *addr_in_block)
|
||||
{
|
||||
return block_for_pc (read_pc ());
|
||||
CORE_ADDR pc = read_pc ();
|
||||
|
||||
if (addr_in_block)
|
||||
*addr_in_block = pc;
|
||||
|
||||
return block_for_pc (pc);
|
||||
}
|
||||
|
||||
CORE_ADDR
|
||||
|
@ -559,7 +581,7 @@ get_pc_function_start (CORE_ADDR pc)
|
|||
struct symbol *
|
||||
get_frame_function (struct frame_info *frame)
|
||||
{
|
||||
register struct block *bl = get_frame_block (frame);
|
||||
register struct block *bl = get_frame_block (frame, 0);
|
||||
if (bl == 0)
|
||||
return 0;
|
||||
return block_function (bl);
|
||||
|
|
|
@ -5699,7 +5699,7 @@ get_catch_sals (int this_level_only)
|
|||
but it's better than a core dump. */
|
||||
if (selected_frame == NULL)
|
||||
error ("No selected frame.");
|
||||
block = get_frame_block (selected_frame);
|
||||
block = get_frame_block (selected_frame, 0);
|
||||
pc = selected_frame->pc;
|
||||
|
||||
sals.nelts = 0;
|
||||
|
|
|
@ -551,7 +551,7 @@ addresses have not been bound by the dynamic loader. Try again when executable i
|
|||
|
||||
if (frame == NULL)
|
||||
return 0;
|
||||
b = get_frame_block (frame);
|
||||
b = get_frame_block (frame, 0);
|
||||
|
||||
if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR)
|
||||
{
|
||||
|
|
|
@ -196,11 +196,12 @@ extern struct frame_info *get_current_frame (void);
|
|||
|
||||
extern struct frame_info *get_next_frame (struct frame_info *);
|
||||
|
||||
extern struct block *get_frame_block (struct frame_info *);
|
||||
extern struct block *get_frame_block (struct frame_info *,
|
||||
CORE_ADDR *addr_in_block);
|
||||
|
||||
extern struct block *get_current_block (void);
|
||||
extern struct block *get_current_block (CORE_ADDR *addr_in_block);
|
||||
|
||||
extern struct block *get_selected_block (void);
|
||||
extern struct block *get_selected_block (CORE_ADDR *addr_in_block);
|
||||
|
||||
extern struct symbol *get_frame_function (struct frame_info *);
|
||||
|
||||
|
|
|
@ -1187,7 +1187,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
|
|||
|
||||
sym = lookup_symbol (copy,
|
||||
(s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
|
||||
: get_selected_block ()),
|
||||
: get_selected_block (0)),
|
||||
VAR_NAMESPACE, 0, &sym_symtab);
|
||||
|
||||
symbol_found: /* We also jump here from inside the C++ class/namespace
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2002-04-05 Jim Blandy <jimb@redhat.com>
|
||||
|
||||
* mi-cmd-stack.c (list_args_or_locals): Pass new arg to
|
||||
get_frame_block. (See entry in gdb/ChangeLog.)
|
||||
|
||||
2002-04-05 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* mi-cmd-disas.c (mi_cmd_disassemble): Use TARGET_PRINT_INSN
|
||||
|
|
|
@ -218,7 +218,7 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
|
|||
|
||||
stb = ui_out_stream_new (uiout);
|
||||
|
||||
block = get_frame_block (fi);
|
||||
block = get_frame_block (fi, 0);
|
||||
|
||||
ui_out_list_begin (uiout, locals ? "locals" : "args");
|
||||
|
||||
|
|
|
@ -1134,7 +1134,7 @@ parse_exp_1 (char **stringptr, struct block *block, int comma)
|
|||
old_chain = make_cleanup (free_funcalls, 0 /*ignore*/);
|
||||
funcall_chain = 0;
|
||||
|
||||
expression_context_block = block ? block : get_selected_block ();
|
||||
expression_context_block = block ? block : get_selected_block (0);
|
||||
|
||||
namecopy = (char *) alloca (strlen (lexptr) + 1);
|
||||
expout_size = 10;
|
||||
|
|
|
@ -1113,7 +1113,7 @@ address_info (char *exp, int from_tty)
|
|||
if (exp == 0)
|
||||
error ("Argument required.");
|
||||
|
||||
sym = lookup_symbol (exp, get_selected_block (), VAR_NAMESPACE,
|
||||
sym = lookup_symbol (exp, get_selected_block (0), VAR_NAMESPACE,
|
||||
&is_a_field_of_this, (struct symtab **) NULL);
|
||||
if (sym == NULL)
|
||||
{
|
||||
|
@ -1549,7 +1549,7 @@ do_one_display (struct display *d)
|
|||
return;
|
||||
|
||||
if (d->block)
|
||||
within_current_scope = contained_in (get_selected_block (), d->block);
|
||||
within_current_scope = contained_in (get_selected_block (0), d->block);
|
||||
else
|
||||
within_current_scope = 1;
|
||||
if (!within_current_scope)
|
||||
|
@ -1683,7 +1683,7 @@ Num Enb Expression\n");
|
|||
else if (d->format.format)
|
||||
printf_filtered ("/%c ", d->format.format);
|
||||
print_expression (d->exp, gdb_stdout);
|
||||
if (d->block && !contained_in (get_selected_block (), d->block))
|
||||
if (d->block && !contained_in (get_selected_block (0), d->block))
|
||||
printf_filtered (" (cannot be evaluated in the current context)");
|
||||
printf_filtered ("\n");
|
||||
gdb_flush (gdb_stdout);
|
||||
|
|
16
gdb/stack.c
16
gdb/stack.c
|
@ -1238,7 +1238,7 @@ static void
|
|||
print_frame_local_vars (register struct frame_info *fi, register int num_tabs,
|
||||
register struct ui_file *stream)
|
||||
{
|
||||
register struct block *block = get_frame_block (fi);
|
||||
register struct block *block = get_frame_block (fi, 0);
|
||||
register int values_printed = 0;
|
||||
|
||||
if (block == 0)
|
||||
|
@ -1272,7 +1272,7 @@ print_frame_label_vars (register struct frame_info *fi, int this_level_only,
|
|||
register struct ui_file *stream)
|
||||
{
|
||||
register struct blockvector *bl;
|
||||
register struct block *block = get_frame_block (fi);
|
||||
register struct block *block = get_frame_block (fi, 0);
|
||||
register int values_printed = 0;
|
||||
int index, have_default = 0;
|
||||
char *blocks_printed;
|
||||
|
@ -1501,17 +1501,21 @@ record_selected_frame (CORE_ADDR *frameaddrp, int *levelp)
|
|||
}
|
||||
|
||||
/* Return the symbol-block in which the selected frame is executing.
|
||||
Can return zero under various legitimate circumstances. */
|
||||
Can return zero under various legitimate circumstances.
|
||||
|
||||
If ADDR_IN_BLOCK is non-zero, set *ADDR_IN_BLOCK to the relevant
|
||||
code address within the block returned. We use this to decide
|
||||
which macros are in scope. */
|
||||
|
||||
struct block *
|
||||
get_selected_block (void)
|
||||
get_selected_block (CORE_ADDR *addr_in_block)
|
||||
{
|
||||
if (!target_has_stack)
|
||||
return 0;
|
||||
|
||||
if (!selected_frame)
|
||||
return get_current_block ();
|
||||
return get_frame_block (selected_frame);
|
||||
return get_current_block (addr_in_block);
|
||||
return get_frame_block (selected_frame, addr_in_block);
|
||||
}
|
||||
|
||||
/* Find a frame a certain number of levels away from FRAME.
|
||||
|
|
|
@ -3312,7 +3312,7 @@ make_symbol_completion_list (char *text, char *word)
|
|||
/* Search upwards from currently selected frame (so that we can
|
||||
complete on local vars. */
|
||||
|
||||
for (b = get_selected_block (); b != NULL; b = BLOCK_SUPERBLOCK (b))
|
||||
for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
|
||||
{
|
||||
if (!BLOCK_SUPERBLOCK (b))
|
||||
{
|
||||
|
@ -3845,7 +3845,7 @@ make_symbol_overload_list (struct symbol *fsym)
|
|||
/* Search upwards from currently selected frame (so that we can
|
||||
complete on local vars. */
|
||||
|
||||
for (b = get_selected_block (); b != NULL; b = BLOCK_SUPERBLOCK (b))
|
||||
for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
|
||||
{
|
||||
if (!BLOCK_SUPERBLOCK (b))
|
||||
{
|
||||
|
|
|
@ -426,7 +426,7 @@ varobj_create (char *objname,
|
|||
|
||||
block = NULL;
|
||||
if (fi != NULL)
|
||||
block = get_frame_block (fi);
|
||||
block = get_frame_block (fi, 0);
|
||||
|
||||
p = expression;
|
||||
innermost_block = NULL;
|
||||
|
|
Loading…
Reference in a new issue