[PATCH v2 1/3] rtems-debugger: Fixed 32bit pointers

Chris Johns chrisj at rtems.org
Thu Mar 18 19:56:11 UTC 2021


On 19/3/21 4:49 am, Joel Sherrill wrote:
> On Thu, Mar 18, 2021 at 12:33 PM Stephen Clark <stephen.clark at oarcorp.com
> <mailto:stephen.clark at oarcorp.com>> wrote:
> 
>     Using 32bit types like uint32_t for pointers creates issues on 64 bit
>     architectures like AArch64. Replaced occurrences of these with uintptr_t,
>     which will work for both 32 and 64 bit architectures.
>     ---
>      cpukit/libdebugger/rtems-debugger-server.c | 4 ++--
>      cpukit/libdebugger/rtems-debugger-target.c | 2 +-
>      cpukit/libdebugger/rtems-debugger-target.h | 2 +-
>      3 files changed, 4 insertions(+), 4 deletions(-)
> 
>     diff --git a/cpukit/libdebugger/rtems-debugger-server.c
>     b/cpukit/libdebugger/rtems-debugger-server.c
>     index 975ec23a30..f8c485a794 100644
>     --- a/cpukit/libdebugger/rtems-debugger-server.c
>     +++ b/cpukit/libdebugger/rtems-debugger-server.c
>     @@ -1438,7 +1438,7 @@ remote_read_memory(uint8_t* buffer, int size)
>        if (comma == NULL)
>          remote_packet_out_str(r_E01);
>        else {
>     -    DB_UINT addr;
>     +    uintptr_t addr;
>          DB_UINT length;
>          int     r;
>          addr = hex_decode_uint(&buffer[1]);
>     @@ -1468,7 +1468,7 @@ remote_write_memory(uint8_t* buffer, int size)
>        comma = strchr((const char*) buffer, ',');
>        colon = strchr((const char*) buffer, ':');
>        if (comma != NULL && colon != NULL) {
>     -    DB_UINT addr;
>     +    uintptr_t addr;
>          DB_UINT length;
>          int     r;
>          addr = hex_decode_uint(&buffer[1]);
> 
> I think the changes OK but Chris should comment what 
> happens on 64-bit address targets.
> 
> I think this may be decoding the gdb protocol message and we need
> to know if the field coming in is OK to decode as a uint. 
> 
> Your patch is OK but there may be an issue interfacing with the protocol
> that this points out.

The change looks fine to me

Chris


More information about the devel mailing list