gdb:
* macrocmd.c (macro_define_command): Check for NULL argument. (macro_undef_command): Likewise. gdb/testsuite: * gdb.base/macscp.exp: Add regression test for "macro define" or "macro undef" with no arguments.
This commit is contained in:
parent
4e96a12e09
commit
886a217cf4
@ -1,3 +1,8 @@
|
||||
2008-08-14 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* macrocmd.c (macro_define_command): Check for NULL argument.
|
||||
(macro_undef_command): Likewise.
|
||||
|
||||
2008-08-14 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* infcmd.c (continue_1): Add an ERROR_NO_INFERIOR call.
|
||||
|
@ -235,8 +235,12 @@ macro_define_command (char *exp, int from_tty)
|
||||
{
|
||||
struct macro_definition new_macro;
|
||||
char *name = NULL;
|
||||
struct cleanup *cleanup_chain = make_cleanup (free_macro_definition_ptr,
|
||||
&new_macro);
|
||||
struct cleanup *cleanup_chain;
|
||||
|
||||
if (!exp)
|
||||
error (_("usage: macro define NAME[(ARGUMENT-LIST)] [REPLACEMENT-LIST]"));
|
||||
|
||||
cleanup_chain = make_cleanup (free_macro_definition_ptr, &new_macro);
|
||||
make_cleanup (free_current_contents, &name);
|
||||
|
||||
memset (&new_macro, 0, sizeof (struct macro_definition));
|
||||
@ -308,6 +312,10 @@ static void
|
||||
macro_undef_command (char *exp, int from_tty)
|
||||
{
|
||||
char *name;
|
||||
|
||||
if (!exp)
|
||||
error (_("usage: macro undef NAME"));
|
||||
|
||||
skip_ws (&exp);
|
||||
name = extract_identifier (&exp);
|
||||
if (! name)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2008-08-14 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* gdb.base/macscp.exp: Add regression test for "macro define" or
|
||||
"macro undef" with no arguments.
|
||||
|
||||
2008-08-08 Paul Pluzhnikov <ppluzhnikov@google.com>
|
||||
|
||||
* gdb.base/args.exp: Prevent ~/.gdbinit from affecting test.
|
||||
|
@ -470,6 +470,16 @@ gdb_test "print M" \
|
||||
"No symbol \"M\" in current context\." \
|
||||
"print expression with macro after user undef."
|
||||
|
||||
# Regression test; this used to crash.
|
||||
gdb_test "macro define" \
|
||||
"usage: macro define.*" \
|
||||
"macro define with no arguments"
|
||||
|
||||
# Regression test; this used to crash.
|
||||
gdb_test "macro undef" \
|
||||
"usage: macro undef.*" \
|
||||
"macro undef with no arguments"
|
||||
|
||||
# Regression test; this used to emit the wrong error.
|
||||
gdb_test "macro expand SPLICE(x, y)" \
|
||||
"Token splicing is not implemented yet." \
|
||||
|
Loading…
x
Reference in New Issue
Block a user