GDB macros

Joel Sherrill joel.sherrill at
Tue Sep 12 13:18:49 UTC 2006

Luca Germano wrote:
> I'm using Leon3 CPU.
> If I want to debug the macros how can I do?

The only way to debug these macros I know of it to put debug prints.

I suspect you are not getting past here:

define rtems_helper_show_task
    set $pt = (Thread_Control *)$arg0.local_table[$arg1]
    rtems_helper_task_dump $arg1 $pt 1

put a print in to see if you get past setting $pt.

If you do, then drop prints into rtems_helper_task_dump until you narrow 
it down.

The macro expansion can be weird to debug at times.  From what I can 
tell, you can't
do something like ${VAR} like in shell.  But my tests make it look like 
you are
allowed a space after the variable so something like this may work:

define j1
  set $x = _Thread_Executing
  printf "%x\n", $x->
  printf "%x\n", $x ->

Just a guess.

> Thanks
>> From: Joel Sherrill <joel.sherrill at>
>> To: Luca Germano <lucagermano at>
>> CC: rtems-users at
>> Subject: Re: GDB macros
>> Date: Tue, 12 Sep 2006 06:28:48 -0500
>> Luca Germano wrote:
>>> Thanks for the help.
>>> I try to use the rtems_classic_tasks macro but gdb give me the 
>>> following reply
>> The only way I know to debug these macros is careful insertion of 
>> debug prints.
>> What CPU are you on?  AFAIK backtrace is the only routine which requires
>> CPU specific tinkering.
>>> =====================================================================
>>> Attempt to extract a component of a value that is not a structure.
>>> # | Name |    ID    | Pri |  Ticks   | State
>>> ---+------+----------+-----+----------+------------------------------
>>> How can I solve this problem?
>>> Best regards
>>> Luca Germano

More information about the users mailing list