[patch gdb]: Fix PR gdb/15161 part 1 of 3

Pedro Alves palves@redhat.com
Tue Feb 19 18:25:00 GMT 2013


On 02/19/2013 05:18 PM, Kai Tietz wrote:
> Hi,
> 
> this patch fixes part one of the PR gdb/15161 issue in symfile.c.
> 
> ChangeLog
> 
> 2013-02-19  Kai Tietz  <ktietz@redhat.com>
> 
> 	PR gdb/15161
> 	* symfile.c (load_section_data): Change type of load_offset
> 	to CORE_ADDR.
> 	(generic_load): User strtoulst instead of strtoul for evalute of
> 	load_offset.

Typo "evalute".  You mean "evaluation"?  FWIW, I think "conversion" is
more to the point, as strtol is documented to "convert a string to ...".

>  /* Opaque data for load_section_callback.  */
>  struct load_section_data {
> -  unsigned long load_offset;
> +  CORE_ADDR load_offset;
>    struct load_progress_data *progress_data;
>    VEC(memory_write_request_s) *requests;
>  };
...
> -      cbdata.load_offset = strtoul (argv[1], &endptr, 0);
> +      cbdata.load_offset = (CORE_ADDR) strtoulst (argv[1], &endptr, 0);

Was the cast really necessary?  If ever CORE_ADDR and ULONGEST have
different widths in a way this would cause a warning/error, then
it'd be better to not have that bug masked with a cast.

So OK without the cast.

Thanks.

-- 
Pedro Alves



More information about the Gdb-patches mailing list