diff options
| author | Alan Modra <amodra@gmail.com> | 2025-10-04 08:44:58 +0930 |
|---|---|---|
| committer | Alan Modra <amodra@gmail.com> | 2025-10-04 09:39:02 +0930 |
| commit | 58a722afdb64a2c4b2ce606d4628214b890705d3 (patch) | |
| tree | f7278e52e605234620ccb91d439ab71650031687 /gdb/python/python.c | |
| parent | 3fc9616817eb5467dcd23bf4b00a95b752c20554 (diff) | |
| download | binutils-58a722afdb64a2c4b2ce606d4628214b890705d3.zip binutils-58a722afdb64a2c4b2ce606d4628214b890705d3.tar.gz binutils-58a722afdb64a2c4b2ce606d4628214b890705d3.tar.bz2 | |
gdb: PR 33384 invalid disassembler option message
This is the gdb part of fixing PR33384, where it is noted that an
error in a disassembler option prints the rest of the comma separated
option string rather than just the option in error.
Removing FOR_EACH_DISASSEMBLER_OPTION seemed a good idea to me, as we
then expose the strchr there which is useful in zero terminating the
option, and in the case of arm-tdep.c, to replace strcspn. Also, if
the option is zero terminated we don't need disassembler_options_cmp.
Alternatively, you could do similarly to arm-tdep.c in disasm.c by
changing the error message to use %.*s with a length found by strcspn.
I rejected that smaller patch on the grounds that it makes for churn
in message translation. I also prefer to see code using the standard
string functions.
Regression tested on x86_64-linux. Message behaviour tested on
powerpc64le-linux and arm-linux-eabi.
* arm-tdep.c (show_disassembly_style_sfunc): Don't use
FOR_EACH_DISASSEMBLER_OPTION. Use strchr needed for loop
control to size option len.
* disasm.c (set_disassembler_options): Don't use
FOR_EACH_DISASSEMBLER_OPTION. Overwrite comma in options with
a zero. Replace disassembler_options_cmp with strcmp.
Diffstat (limited to 'gdb/python/python.c')
0 files changed, 0 insertions, 0 deletions
