aboutsummaryrefslogtreecommitdiff
path: root/gdb/parse.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-05-03 22:30:51 +0000
committerPedro Alves <palves@redhat.com>2008-05-03 22:30:51 +0000
commitd705c43c5aa1551e91d5dfbd73ea8d4ba0f0758d (patch)
tree0cd3088b8c0e98bdfd64cabdde74bbf4e453d9e6 /gdb/parse.c
parentd6350901aab6846f8a3ad3f519d0e1cc37a5d677 (diff)
downloadbinutils-d705c43c5aa1551e91d5dfbd73ea8d4ba0f0758d.zip
binutils-d705c43c5aa1551e91d5dfbd73ea8d4ba0f0758d.tar.gz
binutils-d705c43c5aa1551e91d5dfbd73ea8d4ba0f0758d.tar.bz2
gdb/
* parse.c (parse_exp_in_context): Don't override expression_context_pc if get_selected_block returned a valid block. gdb/testsuite/ * gdb.base/macscp.exp, gdb.base/macscp1.c: Add test for printing expressions with macros.
Diffstat (limited to 'gdb/parse.c')
-rw-r--r--gdb/parse.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/gdb/parse.c b/gdb/parse.c
index 734739a..9c0edf5 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -961,26 +961,24 @@ parse_exp_in_context (char **stringptr, struct block *block, int comma,
old_chain = make_cleanup (free_funcalls, 0 /*ignore*/);
funcall_chain = 0;
- /* If no context specified, try using the current frame, if any. */
+ expression_context_block = block;
- if (!block)
- block = get_selected_block (&expression_context_pc);
+ /* If no context specified, try using the current frame, if any. */
+ if (!expression_context_block)
+ expression_context_block = get_selected_block (&expression_context_pc);
+ else
+ expression_context_pc = BLOCK_START (expression_context_block);
- /* Fall back to using the current source static context, if any. */
+ /* Fall back to using the current source static context, if any. */
- if (!block)
+ if (!expression_context_block)
{
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (cursal.symtab)
- block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (cursal.symtab), STATIC_BLOCK);
- }
-
- /* Save the context, if specified by caller, or found above. */
-
- if (block)
- {
- expression_context_block = block;
- expression_context_pc = BLOCK_START (block);
+ expression_context_block
+ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (cursal.symtab), STATIC_BLOCK);
+ if (expression_context_block)
+ expression_context_pc = BLOCK_START (expression_context_block);
}
expout_size = 10;