Is there a way to know exactly the address range of both the heap and the stack on an RTEMS application by using gdb? I know there's info proc mappings
on Linux, but I don't think RTEMS has a /proc to begin with. Using x
to examine memory would be great but I need to know the address range of both.
I know there are some tips in http://www.rtems.org/wiki/index.php/Debugging, but they themselves admit those are really crude estimates.
For the heap you can investigate the Heap_Control
structure (defined at cpukit/score/include/rtems/score/heap.h) and the two variables, RTEMS_Malloc_Heap
and _Workspace_Area
. In particular you seem interested in the Heap_Control.area_begin
and Heap_Control.area_end
fields. The _Workspace_Area
can be part of the heap or a separate memory region, and it holds the kernel data structures. The RTEMS_Malloc_Heap
points to the Heap_Control describing the traditional C program heap.
For the stack, you can look at the Thread_Start_information
structure (defined at cpukit/score/include/rtems/score/thread.h) contained in the Thread_Control
associated with the thread whose stack you want to examine. You can get a pointer to the executing thread with the _Thread_Executing
macro.