Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: ppluzhnikov@google.com (Paul Pluzhnikov)
To: gdb-patches@sourceware.org
Cc: ppluzhnikov@google.com
Subject: [patch] Allow "disassemble 'Foo::bar(char *)'"
Date: Sat, 14 Nov 2009 00:10:00 -0000	[thread overview]
Message-ID: <20091114001022.A0A0776CDD@ppluzhnikov.mtv.corp.google.com> (raw)

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


             reply	other threads:[~2009-11-14  0:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-14  0:10 Paul Pluzhnikov [this message]
2009-11-15  8:54 ` Andreas Schwab
2009-11-15 17:17   ` Paul Pluzhnikov
2009-11-15 17:26     ` Daniel Jacobowitz
2009-11-16 18:26     ` Tom Tromey
2009-11-16 18:29       ` Paul Pluzhnikov
2009-11-19 23:41         ` Paul Pluzhnikov
2009-11-20 17:28           ` Tom Tromey
2009-11-20 17:41             ` Paul Pluzhnikov
2009-11-21  0:44             ` Paul Pluzhnikov
2009-11-21  1:00               ` Daniel Jacobowitz
2009-11-21  1:09                 ` Paul Pluzhnikov
2009-11-21  8:36                   ` Eli Zaretskii
2009-11-22  2:40                     ` Paul Pluzhnikov
2009-11-22  4:28                       ` Eli Zaretskii
2009-11-23  7:45                         ` Paul Pluzhnikov
2009-11-23 11:58                           ` Eli Zaretskii
2009-11-23 17:42                             ` Paul Pluzhnikov
2009-11-23 18:40                               ` Eli Zaretskii
2009-11-23 17:30                       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091114001022.A0A0776CDD@ppluzhnikov.mtv.corp.google.com \
    --to=ppluzhnikov@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox