This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: PATCH: Add --insn-width to objdump


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.


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