[RFC,01/15] Fix endian problem for tracepoint enabled flag

Message ID c6583915ec9ce800b88769723b49d0d1ad394863.1444820235.git.henrik.wallin@windriver.com
State New, archived
Headers

Commit Message

henrik.wallin@windriver.com Oct. 14, 2015, 11:14 a.m. UTC
  From: Par Olsson <par.olsson@windriver.com>

When running big endian machines there is a problem with
the enabled flag for tracepoints as it is defined as a
int8_t but written from gdbserver as an integer and then
read in the agent as 8-bit value.
This caused problem when tracepoint was disabled and
re-enabled.

gdb/gdbserver/ChangeLog:

	* tracepoint.c (struct tracepoint): Change type of enabled.

Signed-off-by: Par Olsson <par.olsson@windriver.com>
Signed-off-by: Henrik Wallin <henrik.wallin@windriver.com>
---
 gdb/gdbserver/tracepoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Pedro Alves Oct. 15, 2015, 5:16 p.m. UTC | #1
On 10/14/2015 12:14 PM, henrik.wallin@windriver.com wrote:
> From: Par Olsson <par.olsson@windriver.com>
> 
> When running big endian machines there is a problem with
> the enabled flag for tracepoints as it is defined as a
> int8_t but written from gdbserver as an integer and then
> read in the agent as 8-bit value.
> This caused problem when tracepoint was disabled and
> re-enabled.
> 
> gdb/gdbserver/ChangeLog:
> 
> 	* tracepoint.c (struct tracepoint): Change type of enabled.

Seems wasteful for no obvious reason.  Why not make gdbserver write
one byte then?

Thanks,
Pedro Alves
  
henrik.wallin@windriver.com Oct. 29, 2015, 5:49 p.m. UTC | #2
2015-10-15 19:16 GMT+02:00 Pedro Alves <palves@redhat.com>:
> On 10/14/2015 12:14 PM, henrik.wallin@windriver.com wrote:
>> From: Par Olsson <par.olsson@windriver.com>
>>
>> When running big endian machines there is a problem with
>> the enabled flag for tracepoints as it is defined as a
>> int8_t but written from gdbserver as an integer and then
>> read in the agent as 8-bit value.
>> This caused problem when tracepoint was disabled and
>> re-enabled.
>>
>> gdb/gdbserver/ChangeLog:
>>
>>       * tracepoint.c (struct tracepoint): Change type of enabled.
>
> Seems wasteful for no obvious reason.  Why not make gdbserver write
> one byte then?

I guess this was the easy fix... I will change the write instead.

thanks,
/ Henrik
  

Patch

diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index b6c70c9cc7a0..a2723e39e500 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -724,7 +724,7 @@  struct tracepoint
   enum tracepoint_type type;
 
   /* True if the tracepoint is currently enabled.  */
-  int8_t enabled;
+  uint32_t enabled;
 
   /* The number of single steps that will be performed after each
      tracepoint hit.  */