Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch gdb]: Fix PR gdb/15161 part 1 of 3
@ 2013-02-19 17:18 Kai Tietz
  2013-02-19 18:25 ` Pedro Alves
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Tietz @ 2013-02-19 17:18 UTC (permalink / raw)
  To: gdb-patches

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.

Ok for apply?

Regards,
Kai

Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.363
diff -p -u -r1.363 symfile.c
--- symfile.c	1 Feb 2013 19:39:03 -0000	1.363
+++ symfile.c	19 Feb 2013 16:52:32 -0000
@@ -1948,7 +1948,7 @@ add_section_size_callback (bfd *abfd, as

 /* 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;
 };
@@ -2126,9 +2126,9 @@ generic_load (char *args, int from_tty)

   if (argv[1] != NULL)
     {
-      char *endptr;
+      const char *endptr;

-      cbdata.load_offset = strtoul (argv[1], &endptr, 0);
+      cbdata.load_offset = (CORE_ADDR) strtoulst (argv[1], &endptr, 0);

       /* If the last word was not a valid number then
          treat it as a file name with spaces in.  */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch gdb]: Fix PR gdb/15161 part 1 of 3
  2013-02-19 17:18 [patch gdb]: Fix PR gdb/15161 part 1 of 3 Kai Tietz
@ 2013-02-19 18:25 ` Pedro Alves
  0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2013-02-19 18:25 UTC (permalink / raw)
  To: Kai Tietz; +Cc: gdb-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-19 18:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 17:18 [patch gdb]: Fix PR gdb/15161 part 1 of 3 Kai Tietz
2013-02-19 18:25 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox