I am debugging the main file, so I do not have an active process to run anything.
I use custom gdb commands to check a lot of data from the main file and try to simplify the process with custom commands.
However, I cannot find a way to force user commands to return values ββthat can be used in other commands.
For instance:
(note the comment in the "return" line)
define dump_linked_list set $node = global_list->head set $count = 1 while $node != 0 printf "%p -->", $node set $node = $node->next set $count = $count + 1 end return $count
Ideally, my dump_linked_list command will return the number of nodes found in the list so that it can be used in another given command:
define higher_function set $total_nodes = dump_linked_list printf "Total Nodes is %d\n", $total_nodes end
Is this possible in gdb commands?
I feel it should be, but I was looking for documentation and cannot find any mention of this or any examples.
source share