* 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.
This commit is contained in:
Pedro Alves 2008-05-03 22:30:51 +00:00
parent d6350901aa
commit d705c43c5a
5 changed files with 59 additions and 14 deletions

View file

@ -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;