Changeset 9b088157 in rtems


Ignore:
Timestamp:
May 13, 2021, 3:13:57 PM (7 months ago)
Author:
Stephen Clark <stephen.clark@…>
Branches:
master
Children:
db9e885
Parents:
75c133bd
git-author:
Stephen Clark <stephen.clark@…> (05/13/21 15:13:57)
git-committer:
Joel Sherrill <joel@…> (10/27/21 18:25:30)
Message:

rtems-debugger: Fixed pointer types to work on 32 and 64 bit architectures

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. Added
hex_decode_addr function to rtems-debugger.

Location:
cpukit/libdebugger
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libdebugger/rtems-debugger-server.c

    r75c133bd r9b088157  
    153153{
    154154  return "0123456789abcdef"[val & 0xf];
     155}
     156
     157static inline uintptr_t
     158hex_decode_addr(const uint8_t* data)
     159{
     160  uintptr_t ui = 0;
     161  size_t  i;
     162  if (data[0] == '-') {
     163    if (data[1] == '1')
     164      ui = (uintptr_t) -1;
     165  }
     166  else {
     167    for (i = 0; i < (sizeof(ui) * 2); ++i) {
     168      int v = hex_decode(data[i]);
     169      if (v < 0)
     170        break;
     171      ui = (ui << 4) | v;
     172    }
     173  }
     174  return ui;
    155175}
    156176
     
    14391459    remote_packet_out_str(r_E01);
    14401460  else {
    1441     DB_UINT addr;
     1461    uintptr_t addr;
    14421462    DB_UINT length;
    14431463    int     r;
    1444     addr = hex_decode_uint(&buffer[1]);
     1464    addr = hex_decode_addr(&buffer[1]);
    14451465    length = hex_decode_uint((const uint8_t*) comma + 1);
    14461466    remote_packet_out_reset();
     
    14691489  colon = strchr((const char*) buffer, ':');
    14701490  if (comma != NULL && colon != NULL) {
    1471     DB_UINT addr;
     1491    uintptr_t addr;
    14721492    DB_UINT length;
    14731493    int     r;
    1474     addr = hex_decode_uint(&buffer[1]);
     1494    addr = hex_decode_addr(&buffer[1]);
    14751495    length = hex_decode_uint((const uint8_t*) comma + 1);
    14761496    r = rtems_debugger_target_start_memory_access();
     
    15201540    if (comma2 != NULL) {
    15211541      uint32_t capabilities;
    1522       DB_UINT  addr;
     1542      uintptr_t  addr;
    15231543      DB_UINT  kind;
    1524       addr = hex_decode_uint((const uint8_t*) comma1 + 1);
     1544      addr = hex_decode_addr((const uint8_t*) comma1 + 1);
    15251545      kind = hex_decode_uint((const uint8_t*)comma2 + 1);
    15261546      capabilities = rtems_debugger_target_capabilities();
  • cpukit/libdebugger/rtems-debugger-target.c

    r75c133bd r9b088157  
    169169
    170170int
    171 rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
     171rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT kind)
    172172{
    173173  rtems_debugger_target*         target = rtems_debugger->target;
  • cpukit/libdebugger/rtems-debugger-target.h

    r75c133bd r9b088157  
    201201 */
    202202extern int rtems_debugger_target_swbreak_control(bool    insert,
    203                                                  DB_UINT addr,
     203                                                 uintptr_t addr,
    204204                                                 DB_UINT kind);
    205205
Note: See TracChangeset for help on using the changeset viewer.