This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Allow "disassemble 'Foo::bar(char *)'"
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: gdb-patches at sourceware dot org
- Cc: ppluzhnikov at google dot com
- Date: Fri, 13 Nov 2009 16:10:22 -0800 (PST)
- Subject: [patch] Allow "disassemble 'Foo::bar(char *)'"
Greetings,
Consider this test:
struct Foo
{
void bar(const char *s) { }
};
int main (void)
{
Foo().bar("hello");
return 0;
}
And the following GDB behavior:
(gdb) disas 'Foo::b<TAB> ## completes to:
(gdb) disas 'Foo::bar(char const*)'
Unmatched single quote.
This (IMHO very confusing behavior) is happening because disassemble_command
unconditionally splits the argument on the first space, and then tries to
parse "'Foo::bar(char" as the start address.
Attached patch fixes that (no regressions on Linux/x86_64).
Thanks,
--
Paul Pluzhnikov
2009-11-13 Paul Pluzhnikov <ppluzhnikov@google.com>
* cli/cli-cmds.c (disassemble_command): Respect quotes.
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.93
diff -u -p -u -r1.93 cli-cmds.c
--- cli/cli-cmds.c 23 Oct 2009 00:49:33 -0000 1.93
+++ cli/cli-cmds.c 13 Nov 2009 23:59:08 -0000
@@ -1025,7 +1025,8 @@ disassemble_command (char *arg, int from
/* FIXME: 'twould be nice to allow spaces in the expression for the first
arg. Allow comma separater too? */
- if (!(space_index = (char *) strchr (arg, ' ')))
+ space_index = skip_quoted (arg);
+ if (!(space_index = (char *) strchr (space_index, ' ')))
{
/* One argument. */
pc = parse_and_eval_address (arg);