Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix use of uninitialized value in linux-arm-low in GDBServer.
@ 2015-09-24 17:30 Antoine Tremblay
  2015-09-25 11:10 ` Yao Qi
  0 siblings, 1 reply; 5+ messages in thread
From: Antoine Tremblay @ 2015-09-24 17:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Antoine Tremblay

In arm_breakpoint_at, an uninitialized unsigned long was used were only
4 bytes would be written to the variable thus polluting the value on 64bit.

This patch changes the value to an unsigned int.

gdb/gdbserver/ChangeLog:
	* linux-arm-low.c (arm_breakpoint_at): Fix insn size.
---
 gdb/gdbserver/linux-arm-low.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index a277bb6..b594e57 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -272,7 +272,7 @@ arm_breakpoint_at (CORE_ADDR where)
   else
     {
       /* ARM mode.  */
-      unsigned long insn;
+      unsigned int insn;
 
       (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
       if (insn == arm_breakpoint)
-- 
1.9.1


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

* Re: [PATCH] Fix use of uninitialized value in linux-arm-low in GDBServer.
  2015-09-24 17:30 [PATCH] Fix use of uninitialized value in linux-arm-low in GDBServer Antoine Tremblay
@ 2015-09-25 11:10 ` Yao Qi
  2015-09-25 11:33   ` Antoine Tremblay
  0 siblings, 1 reply; 5+ messages in thread
From: Yao Qi @ 2015-09-25 11:10 UTC (permalink / raw)
  To: Antoine Tremblay; +Cc: gdb-patches

Antoine Tremblay <antoine.tremblay@ericsson.com> writes:

> In arm_breakpoint_at, an uninitialized unsigned long was used were only
> 4 bytes would be written to the variable thus polluting the value on 64bit.

'unsigned long' is 32-bit on arm.  What problem do you want to fix?

-- 
Yao (齐尧)


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

* Re: [PATCH] Fix use of uninitialized value in linux-arm-low in GDBServer.
  2015-09-25 11:10 ` Yao Qi
@ 2015-09-25 11:33   ` Antoine Tremblay
  2015-09-25 11:42     ` Antoine Tremblay
  0 siblings, 1 reply; 5+ messages in thread
From: Antoine Tremblay @ 2015-09-25 11:33 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches



On 09/25/2015 07:10 AM, Yao Qi wrote:
> Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
>
>> In arm_breakpoint_at, an uninitialized unsigned long was used were only
>> 4 bytes would be written to the variable thus polluting the value on 64bit.
>
> 'unsigned long' is 32-bit on arm.  What problem do you want to fix?
>

Won't this function be used if you're debugging an arm program on aarch64 ?


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

* Re: [PATCH] Fix use of uninitialized value in linux-arm-low in GDBServer.
  2015-09-25 11:33   ` Antoine Tremblay
@ 2015-09-25 11:42     ` Antoine Tremblay
  2015-09-29 14:05       ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Antoine Tremblay @ 2015-09-25 11:42 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches



On 09/25/2015 07:33 AM, Antoine Tremblay wrote:
>
>
> On 09/25/2015 07:10 AM, Yao Qi wrote:
>> Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
>>
>>> In arm_breakpoint_at, an uninitialized unsigned long was used were only
>>> 4 bytes would be written to the variable thus polluting the value on
>>> 64bit.
>>
>> 'unsigned long' is 32-bit on arm.  What problem do you want to fix?
>>
>
> Won't this function be used if you're debugging an arm program on aarch64 ?
>
Looking at it more , I don't think so, sorry for the noise it just 
jumped to me as I was fixing a similar issue elsewhere.


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

* Re: [PATCH] Fix use of uninitialized value in linux-arm-low in GDBServer.
  2015-09-25 11:42     ` Antoine Tremblay
@ 2015-09-29 14:05       ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2015-09-29 14:05 UTC (permalink / raw)
  To: Antoine Tremblay, Yao Qi; +Cc: gdb-patches

On 09/25/2015 12:42 PM, Antoine Tremblay wrote:
> 
> 
> On 09/25/2015 07:33 AM, Antoine Tremblay wrote:
>>
>>
>> On 09/25/2015 07:10 AM, Yao Qi wrote:
>>> Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
>>>
>>>> In arm_breakpoint_at, an uninitialized unsigned long was used were only
>>>> 4 bytes would be written to the variable thus polluting the value on
>>>> 64bit.
>>>
>>> 'unsigned long' is 32-bit on arm.  What problem do you want to fix?
>>>
>>
>> Won't this function be used if you're debugging an arm program on aarch64 ?
>>
> Looking at it more , I don't think so, sorry for the noise it just 
> jumped to me as I was fixing a similar issue elsewhere.
> 

Note that gnulib gives us stdint.h everywhere nowadays, so in these
cases the best/clearest would be to use uint32_t, etc.

Thanks,
Pedro Alves


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

end of thread, other threads:[~2015-09-29 14:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-24 17:30 [PATCH] Fix use of uninitialized value in linux-arm-low in GDBServer Antoine Tremblay
2015-09-25 11:10 ` Yao Qi
2015-09-25 11:33   ` Antoine Tremblay
2015-09-25 11:42     ` Antoine Tremblay
2015-09-29 14:05       ` Pedro Alves

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