This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[doc RFA] improve docs on disassemble command


Hi.
gdb is a bit inconsistent at times.

While "break foo.c:bar" works, "disassemble foo.c:bar" does not,
and one has to instead do "disassemble 'foo.c'::bar".
Note the quotes and the ::.

This text clarifies things so those who've long since paged out
the difference but know to at least try help, will find the answer.

Ok to check in?

2013-02-06  Doug Evans  <dje@google.com>

	* cli/cli-cmds.c (_initialize_cli_cmds): Clarify argument to
	disassemble command.

	doc/
	* gdb.texinfo (Machine Code): Clarify argument to disassemble
	command.

Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.148
diff -u -p -r1.148 cli-cmds.c
--- cli/cli-cmds.c	3 Feb 2013 16:13:30 -0000	1.148
+++ cli/cli-cmds.c	6 Feb 2013 21:12:51 -0000
@@ -1843,7 +1844,12 @@ With a /m modifier, source lines are inc
 With a /r modifier, raw instructions in hex are included.\n\
 With a single argument, the function surrounding that address is dumped.\n\
 Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
-  in the form of \"start,end\", or \"start,+length\"."));
+  in the form of \"start,end\", or \"start,+length\".\n\
+\n\
+Note that the address is interpreted as an expression, not as a location\n\
+like in the \"break\" command.\n\
+So, for example, if you want to disassemble function bar in file foo.c\n\
+you must type \"disassemble 'foo.c'::bar\" and not \"disassemble foo.c:bar\"."));
   set_cmd_completer (c, location_completer);
   if (xdb_commands)
     add_com_alias ("va", "disassemble", class_xdb, 0);
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.1048
diff -u -p -r1.1048 gdb.texinfo
--- doc/gdb.texinfo	3 Feb 2013 16:09:31 -0000	1.1048
+++ doc/gdb.texinfo	6 Feb 2013 21:12:52 -0000
@@ -7373,6 +7373,11 @@ Dump of assembler code from 0x400281 to 
 End of assembler dump.
 @end smallexample
 
+Addresses cannot be specified as a linespec (@pxref{Specify Location}).
+So, for example, if you want to disassemble function @code{bar}
+in file @file{foo.c}, you must type @samp{disassemble 'foo.c'::bar}
+and not @samp{disassemble foo.c:bar}.
+
 Some architectures have more than one commonly-used set of instruction
 mnemonics or other syntax.
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]