From 21a0512e533ac4e5d504e6674ff1361da59535fc Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Mon, 23 Nov 2009 18:44:11 +0000 Subject: [PATCH] gdb/ChangeLog: 2009-11-23 Paul Pluzhnikov * cli/cli-cmds.c (disassemble_command): Split on comma. (init_cli_cmds): Update help. * NEWS: Mention incompatible change to 'disassemble'. gdb/testsuite/ChangeLog: 2009-11-23 Paul Pluzhnikov * gdb.asm/asm-source.exp: Adjust. * gdb.base/help.exp: Adjust. gdb/doc/ChangeLog: 2009-11-23 Paul Pluzhnikov * gdb.texinfo (Machine Code): Adjust. --- gdb/ChangeLog | 6 ++++++ gdb/NEWS | 6 ++++++ gdb/cli/cli-cmds.c | 17 +++++++---------- gdb/doc/ChangeLog | 4 ++++ gdb/doc/gdb.texinfo | 14 +++++++++----- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.asm/asm-source.exp | 4 ++-- gdb/testsuite/gdb.base/help.exp | 2 +- 8 files changed, 40 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bd4c470714..d763d4329d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2009-11-23 Paul Pluzhnikov + + * cli/cli-cmds.c (disassemble_command): Split on comma. + (init_cli_cmds): Update help. + * NEWS: Mention incompatible change to 'disassemble'. + 2009-11-22 Pedro Alves Make hardware breakpoints work for process repord. diff --git a/gdb/NEWS b/gdb/NEWS index 0c870e3216..6bc04db25d 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -22,6 +22,12 @@ Xilinx MicroBlaze microblaze lists inferiors that are not running yet or that have exited already. See also "New commands" and "New options" below. +* Changed commands + +disassemble + The disassemble command, when invoked with two arguments, now requires + the arguments to be comma-separated. + * New commands (for set/show, see "New options" below) record save [] diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index acdbc820b6..865623b930 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -983,7 +983,6 @@ disassemble_command (char *arg, int from_tty) CORE_ADDR low, high; char *name; CORE_ADDR pc, pc_masked; - char *space_index; int flags; name = NULL; @@ -1022,13 +1021,12 @@ disassemble_command (char *arg, int from_tty) return; } - /* FIXME: 'twould be nice to allow spaces in the expression for the first - arg. Allow comma separater too? */ - - if (!(space_index = (char *) strchr (arg, ' '))) + pc = value_as_address (parse_to_comma_and_eval (&arg)); + if (arg[0] == ',') + ++arg; + if (arg[0] == '\0') { /* One argument. */ - pc = parse_and_eval_address (arg); if (find_pc_partial_function (pc, &name, &low, &high) == 0) error (_("No function contains specified address.")); #if defined(TUI) @@ -1044,9 +1042,8 @@ disassemble_command (char *arg, int from_tty) else { /* Two arguments. */ - *space_index = '\0'; - low = parse_and_eval_address (arg); - high = parse_and_eval_address (space_index + 1); + low = pc; + high = parse_and_eval_address (arg); } print_disassembly (gdbarch, name, low, high, flags); @@ -1461,7 +1458,7 @@ Default is the function surrounding the pc of the selected frame.\n\ With a /m modifier, source lines are included (if available).\n\ 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 are taken as a range of memory to dump.")); +Two arguments (separated by a comma) are taken as a range of memory to dump.")); set_cmd_completer (c, location_completer); if (xdb_commands) add_com_alias ("va", "disassemble", class_xdb, 0); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 34e431e46f..76a01759f2 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2009-11-23 Paul Pluzhnikov + + * gdb.texinfo (Machine Code): Adjust. + 2009-11-11 Pedro Alves * agentexpr.texi (Tracing On Symmetrix): Delete section. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a388bc9819..bf76aa135c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -6539,10 +6539,14 @@ in symbolic form by specifying the @code{/r}. The default memory range is the function surrounding the program counter of the selected frame. A single argument to this command is a program counter value; @value{GDBN} dumps the function -surrounding this value. Two arguments specify a range of addresses -(first inclusive, second exclusive) to dump. In that case, the name of -the function is also printed (since there could be several functions in -the given range). +surrounding this value. When two arguments are given, they should +be separated by a comma, possibly surrounded by whitespace. The +arguments specify a range of addresses (first inclusive, second exclusive) +to dump. In that case, the name of the function is also printed (since +there could be several functions in the given range). + +The argument(s) can be any expression yielding a numeric value, such as +@samp{0x32c4}, @samp{&main+10} or @samp{$pc - 8}. If the range of memory being disassembled contains current program counter, the instruction at that location is shown with a @code{=>} marker. @@ -6552,7 +6556,7 @@ The following example shows the disassembly of a range of addresses of HP PA-RISC 2.0 code: @smallexample -(@value{GDBP}) disas 0x32c4 0x32e4 +(@value{GDBP}) disas 0x32c4, 0x32e4 Dump of assembler code from 0x32c4 to 0x32e4: 0x32c4 : addil 0,dp 0x32c8 : ldw 0x22c(sr0,r1),r26 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0d36c9a28f..a64a4513af 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-11-23 Paul Pluzhnikov + + * gdb.asm/asm-source.exp: Adjust. + * gdb.base/help.exp: Adjust. + 2009-11-22 Pedro Alves * gdb.base/catch-syscall.exp (test_catch_syscall_fail_nodatadir) diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 40feba7f21..4b3547d152 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -453,12 +453,12 @@ proc test_dis { command var } { # See if we can look at a global variable, three ways gdb_test "print globalvar" ".* = 11" "look at global variable" test_dis "x/i &globalvar" "globalvar" -test_dis "disassem &globalvar &globalvar+1" "globalvar" +test_dis "disassem &globalvar, &globalvar+1" "globalvar" # See if we can look at a static variable, three ways gdb_test "print staticvar" ".* = 5" "look at static variable" test_dis "x/i &staticvar" "staticvar" -test_dis "disassem &staticvar &staticvar+1" "staticvar" +test_dis "disassem &staticvar, &staticvar+1" "staticvar" # See if we can look at a static function gdb_test "disassem foostatic" ".*<\\+0>:.*End of assembler dump." \ diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp index d76cc36450..0f97e0ca3c 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp @@ -124,7 +124,7 @@ gdb_test "help disable breakpoints" "Disable some breakpoints\.\[\r\n\]+Argument # test help disable display gdb_test "help disable display" "Disable some expressions to be displayed when program stops\.\[\r\n\]+Arguments are the code numbers of the expressions to stop displaying\.\[\r\n\]+No argument means disable all automatic-display expressions\.\[\r\n\]+Do \"info display\" to see current list of code numbers\." "help disable display" # test help disassemble -gdb_test "help disassemble" "Disassemble a specified section of memory\.\[\r\n\]+Default is the function surrounding the pc of the selected frame\.\[\r\n\]+With a /m modifier, source lines are included \\(if available\\)\.\[\r\n\]+With a /r modifier, raw instructions in hex are included\.\[\r\n\]+With a single argument, the function surrounding that address is dumped\.\[\r\n\]+Two arguments are taken as a range of memory to dump\." "help disassemble" +gdb_test "help disassemble" "Disassemble a specified section of memory\.\[\r\n\]+Default is the function surrounding the pc of the selected frame\.\[\r\n\]+With a /m modifier, source lines are included \\(if available\\)\.\[\r\n\]+With a /r modifier, raw instructions in hex are included\.\[\r\n\]+With a single argument, the function surrounding that address is dumped\.\[\r\n\]+Two arguments \\(separated by a comma\\) are taken as a range of memory to dump\." "help disassemble" # test help display gdb_test "help display" "Print value of expression EXP each time the program stops\.\[\r\n\]+/FMT may be used before EXP as in the \"print\" command\.\[\r\n\]+/FMT \"i\" or \"s\" or including a size-letter is allowed,\[\r\n\]+as in the \"x\" command, and then EXP is used to get the address to examine\[\r\n\]+and examining is done as in the \"x\" command\.\[\r\n\]+With no argument, display all currently requested auto-display expressions\.\[\r\n\]+Use \"undisplay\" to cancel display requests previously made\." "help display" # test help do -- 2.34.1