[1/2] Add support for setting disassembler-options in GDB for POWER, ARM and S390

Message ID 019eaf5d-9ace-539e-8501-feb3cb0eed6c@vnet.ibm.com
State New, archived
Headers

Commit Message

Peter Bergner Nov. 18, 2016, 4:56 p.m. UTC
  On 11/18/16 9:37 AM, Eli Zaretskii wrote:
>> Cc: gdb-patches@sourceware.org, Ulrich Weigand <uweigand@de.ibm.com>,        Pedro Alves <palves@redhat.com>, Alan Modra <amodra@gmail.com>,        binutils <binutils@sourceware.org>
>> From: Peter Bergner <bergner@vnet.ibm.com>
>> Date: Fri, 18 Nov 2016 09:10:38 -0600
>>
>> +* New commands
>> +
>> +set disassembler-options
>> +show disassembler-options
>> +  Controls the passing of target specific information to the disassembler.
>> +  Only supported on some targets.  If it is necessary to specify more than
>> +  one disassembler option then multiple options can be placed together into
>> +  a comma separated list.  Default is ''.
> 
> Thanks, but I think we should tell what systems support this.

Sure, how about the following?

Peter
  

Comments

Eli Zaretskii Nov. 18, 2016, 5:07 p.m. UTC | #1
> Cc: nickc@redhat.com, gdb-patches@sourceware.org, uweigand@de.ibm.com,
>         palves@redhat.com, amodra@gmail.com, binutils@sourceware.org
> From: Peter Bergner <bergner@vnet.ibm.com>
> Date: Fri, 18 Nov 2016 10:56:14 -0600
> 
> > Thanks, but I think we should tell what systems support this.
> 
> Sure, how about the following?

Perfect, thanks.
  
Pedro Alves Nov. 18, 2016, 5:23 p.m. UTC | #2
On 11/18/2016 04:56 PM, Peter Bergner wrote:

> diff --git a/gdb/NEWS b/gdb/NEWS
> index a597405..54a6b7b 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -36,6 +36,16 @@
>  
>  Synopsys ARC                   arc*-*-elf32
>  
> +* New commands
> +
> +set disassembler-options
> +show disassembler-options
> +  Controls the passing of target specific information to the disassembler.
> +  If it is necessary to specify more than one disassembler option then
> +  multiple options can be placed together into a comma separated list.
> +  Default is ''.  Currently the only supported targets are ARM, PowerPC
> +  and S/390.
> +

This will need a change to the GDB manual as well.  It'd probably 
be a good idea to refer to the -M/--disassembler-options section
of the binutils/disassembler manual for the architecture specific
options.

It'll be good to include an arch-independent gdb test to make sure
that "set disassembler-options" on other architectures doesn't
crash and cover some corner cases.  E.g., test at least both:

 "set disassembler-options"
 "set disassembler-options non-existing-option"

Thanks,
Pedro Alves
  
Peter Bergner Nov. 22, 2016, 5:04 p.m. UTC | #3
On 11/18/16 11:23 AM, Pedro Alves wrote:
> On 11/18/2016 04:56 PM, Peter Bergner wrote:
> This will need a change to the GDB manual as well.  It'd probably
> be a good idea to refer to the -M/--disassembler-options section
> of the binutils/disassembler manual for the architecture specific
> options.

I don't know the manual at all.  Can you point me to the spot
you'd like the documentation inserted at?


> It'll be good to include an arch-independent gdb test to make sure
> that "set disassembler-options" on other architectures doesn't
> crash and cover some corner cases.  E.g., test at least both:
>
>  "set disassembler-options"
>  "set disassembler-options non-existing-option"

Is there an example of an arch independent gdb test case I can
use as a skeleton?

Peter
  
Pedro Alves Nov. 22, 2016, 5:40 p.m. UTC | #4
On 11/22/2016 05:04 PM, Peter Bergner wrote:
> On 11/18/16 11:23 AM, Pedro Alves wrote:
>> On 11/18/2016 04:56 PM, Peter Bergner wrote:
>> This will need a change to the GDB manual as well.  It'd probably
>> be a good idea to refer to the -M/--disassembler-options section
>> of the binutils/disassembler manual for the architecture specific
>> options.
> 
> I don't know the manual at all.  Can you point me to the spot
> you'd like the documentation inserted at?

Between the documentation of "disassemble" and "set disassembly-flavor",
perhaps?

> 
> 
>> It'll be good to include an arch-independent gdb test to make sure
>> that "set disassembler-options" on other architectures doesn't
>> crash and cover some corner cases.  E.g., test at least both:
>>
>>  "set disassembler-options"
>>  "set disassembler-options non-existing-option"
> 
> Is there an example of an arch independent gdb test case I can
> use as a skeleton?

Most tests are arch independent.  Ones that aren't will
have some istarget check.  Tests in gdb.arch/ are examples.
See "Testsuite Organization" in testsuite/README.

See also <https://sourceware.org/gdb/wiki/GDBTestcaseCookbook>,
though for the suggestion above, you don't even need to compile a
program and run to main.  The suggestion would basically be
translated to something like:

 gdb_exit
 gdb_start

 # Using gdb_test_no_output assuming these (should) produce no output.
 gdb_test_no_output "set disassembler-options"
 gdb_test_no_output "show disassembler-options"

 gdb_test "set disassembler-options non-existing-option" "whatever gdb says"

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index a597405..54a6b7b 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -36,6 +36,16 @@ 
 
 Synopsys ARC                   arc*-*-elf32
 
+* New commands
+
+set disassembler-options
+show disassembler-options
+  Controls the passing of target specific information to the disassembler.
+  If it is necessary to specify more than one disassembler option then
+  multiple options can be placed together into a comma separated list.
+  Default is ''.  Currently the only supported targets are ARM, PowerPC
+  and S/390.
+
 *** Changes in GDB 7.12
 
 * GDB and GDBserver now build with a C++ compiler by default.