[PATCH v1 2/8] cpukit/libdebugger: Use uintptr_t for pointers

Kinsey Moore kinsey.moore at oarcorp.com
Fri Oct 29 21:17:15 UTC 2021


Use uintptr_t instead of DB_UINT when the variable in question describes
a pointer.
---
 cpukit/libdebugger/rtems-debugger-i386.c    | 12 ++++++------
 cpukit/libdebugger/rtems-debugger-target.c  |  2 +-
 cpukit/libdebugger/rtems-debugger-target.h  | 10 +++++-----
 cpukit/libdebugger/rtems-debugger-threads.c |  6 +++---
 cpukit/libdebugger/rtems-debugger-threads.h | 10 +++++-----
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-i386.c b/cpukit/libdebugger/rtems-debugger-i386.c
index a2396e5f30..02e29c25a1 100644
--- a/cpukit/libdebugger/rtems-debugger-i386.c
+++ b/cpukit/libdebugger/rtems-debugger-i386.c
@@ -376,7 +376,7 @@ rtems_debugger_target_write_regs(rtems_debugger_thread* thread)
   return 0;
 }
 
-DB_UINT
+uintptr_t
 rtems_debugger_target_reg_pc(rtems_debugger_thread* thread)
 {
   int r;
@@ -387,13 +387,13 @@ rtems_debugger_target_reg_pc(rtems_debugger_thread* thread)
   return 0;
 }
 
-DB_UINT
+uintptr_t
 rtems_debugger_target_frame_pc(CPU_Exception_frame* frame)
 {
-  return (DB_UINT) frame->eip;
+  return (uintptr_t) frame->eip;
 }
 
-DB_UINT
+uintptr_t
 rtems_debugger_target_reg_sp(rtems_debugger_thread* thread)
 {
   int r;
@@ -404,7 +404,7 @@ rtems_debugger_target_reg_sp(rtems_debugger_thread* thread)
   return 0;
 }
 
-DB_UINT
+uintptr_t
 rtems_debugger_target_tcb_sp(rtems_debugger_thread* thread)
 {
   return (DB_UINT) thread->tcb->Registers.esp;
@@ -503,7 +503,7 @@ rtems_debugger_target_hwbreak_remove(void)
 int
 rtems_debugger_target_hwbreak_control(rtems_debugger_target_watchpoint wp,
                                       bool                             insert,
-                                      DB_UINT                          addr,
+                                      uintptr_t                        addr,
                                       DB_UINT                          kind)
 {
   /*
diff --git a/cpukit/libdebugger/rtems-debugger-target.c b/cpukit/libdebugger/rtems-debugger-target.c
index 34e4e84d2f..04b274909b 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -315,7 +315,7 @@ rtems_debugger_target_exception(CPU_Exception_frame* frame)
     Thread_Control*                      thread = _Thread_Get_executing();
     const rtems_id                       tid = thread->Object.id;
     rtems_id*                            excludes;
-    DB_UINT                              pc;
+    uintptr_t                            pc;
     const rtems_debugger_thread_stepper* stepper;
     rtems_debugger_exception             target_exception;
     size_t                               i;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h b/cpukit/libdebugger/rtems-debugger-target.h
index db356e1f07..1e132fb28c 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -164,22 +164,22 @@ extern int rtems_debugger_target_write_regs(rtems_debugger_thread* thread);
 /**
  * Return the thread's program counter (PC).
  */
-extern DB_UINT rtems_debugger_target_reg_pc(rtems_debugger_thread* thread);
+extern uintptr_t rtems_debugger_target_reg_pc(rtems_debugger_thread* thread);
 
 /**
  * Return the frame's program counter (PC).
  */
-extern DB_UINT rtems_debugger_target_frame_pc(CPU_Exception_frame* frame);
+extern uintptr_t rtems_debugger_target_frame_pc(CPU_Exception_frame* frame);
 
 /**
  * Return the thread's stack pointer (SP).
  */
-extern DB_UINT rtems_debugger_target_reg_sp(rtems_debugger_thread* thread);
+extern uintptr_t rtems_debugger_target_reg_sp(rtems_debugger_thread* thread);
 
 /**
  * Return the thread's TCB stack pointer (SP).
  */
-extern DB_UINT rtems_debugger_target_tcb_sp(rtems_debugger_thread* thread);
+extern uintptr_t rtems_debugger_target_tcb_sp(rtems_debugger_thread* thread);
 
 /**
  * The thread is stepping. Setup the thread to step an instruction.
@@ -228,7 +228,7 @@ extern int rtems_debugger_target_hwbreak_remove(void);
  */
 extern int rtems_debugger_target_hwbreak_control(rtems_debugger_target_watchpoint type,
                                                  bool                             insert,
-                                                 DB_UINT                          addr,
+                                                 uintptr_t                        addr,
                                                  DB_UINT                          kind);
 
 /**
diff --git a/cpukit/libdebugger/rtems-debugger-threads.c b/cpukit/libdebugger/rtems-debugger-threads.c
index e6ffe4a080..c628c0250e 100644
--- a/cpukit/libdebugger/rtems-debugger-threads.c
+++ b/cpukit/libdebugger/rtems-debugger-threads.c
@@ -469,8 +469,8 @@ rtems_debugger_thread_step(rtems_debugger_thread* thread)
 
 int
 rtems_debugger_thread_stepping(rtems_debugger_thread* thread,
-                               DB_UINT                start,
-                               DB_UINT                end)
+                               uintptr_t              start,
+                               uintptr_t              end)
 {
   /* add lock */
   rtems_debugger_threads*        threads = rtems_debugger->threads;
@@ -496,7 +496,7 @@ rtems_debugger_thread_stepping(rtems_debugger_thread* thread,
 }
 
 const rtems_debugger_thread_stepper*
-rtems_debugger_thread_is_stepping(rtems_id id, DB_UINT pc)
+rtems_debugger_thread_is_stepping(rtems_id id, uintptr_t pc)
 {
   /* add lock */
   rtems_debugger_threads*        threads = rtems_debugger->threads;
diff --git a/cpukit/libdebugger/rtems-debugger-threads.h b/cpukit/libdebugger/rtems-debugger-threads.h
index 200dbbe1c7..60bc87984e 100644
--- a/cpukit/libdebugger/rtems-debugger-threads.h
+++ b/cpukit/libdebugger/rtems-debugger-threads.h
@@ -102,8 +102,8 @@ typedef struct rtems_debugger_thread
 typedef struct rtems_debugger_thread_stepper
 {
   rtems_debugger_thread* thread;
-  DB_UINT                start;
-  DB_UINT                end;
+  uintptr_t              start;
+  uintptr_t              end;
 } rtems_debugger_thread_stepper;
 
 /**
@@ -165,15 +165,15 @@ extern int rtems_debugger_thread_step(rtems_debugger_thread* thread);
  * Thread is stepping so record the details.
  */
 extern int rtems_debugger_thread_stepping(rtems_debugger_thread* thread,
-                                          DB_UINT                start,
-                                          DB_UINT                end);
+                                          uintptr_t              start,
+                                          uintptr_t              end);
 
 /**
  * Thread's PC in the stepping range? Returns the stepper is in range else
  * NULL.
  */
 extern const rtems_debugger_thread_stepper*
-rtems_debugger_thread_is_stepping(rtems_id id, DB_UINT pc);
+rtems_debugger_thread_is_stepping(rtems_id id, uintptr_t pc);
 
 /**
  * Return the thread's current priority/
-- 
2.30.2



More information about the devel mailing list