This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Add --insn-width to objdump
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Mon, 20 Jul 2009 06:43:29 -0700
- Subject: Re: PATCH: Add --insn-width to objdump
- References: <20090719185016.GA27224@lucon.org> <4A642731.8050705@redhat.com>
On Mon, Jul 20, 2009 at 1:13 AM, Nick Clifton<nickc@redhat.com> wrote:
> Hi H.J.
>
>> 2009-07-19 ?H.J. Lu ?<hongjiu.lu@intel.com>
>>
>> ? ? ? ?* NEWS: Mention --insn-width.
>>
>> ? ? ? ?* objdump.c (insn_width): New.
>> ? ? ? ?(usage): Display --insn-width.
>> ? ? ? ?(option_values): Add OPTION_INSN_WIDTH.
>> ? ? ? ?(long_options): Add --insn-width.
>> ? ? ? ?(disassemble_bytes): Handle insn_width.
>> ? ? ? ?(main): Handle OPTION_INSN_WIDTH.
>>
>> ? ? ? ?* doc/binutils.texi: Document --insn-width.
>
> Approved, with one minor change:
>
>> + ? ? ? case OPTION_INSN_WIDTH:
>> + ? ? ? ? insn_width = atoi (optarg);
>
> I recommend using strtoul (with a base value of 0) here rather than atoi.
> ?It allows the use to prefix their values with 0x or 0 if they so wish and
> it detects bogus characters in the input value.
>
I checked in:
case OPTION_INSN_WIDTH:
insn_width = strtoul (optarg, NULL, 0);
if (insn_width <= 0)
fatal (_("error: instruction width must be positive"));
break;
since 0 insn width won't work.
Thanks.
--
H.J.