Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] GDB might send additional message on -stack-info-depth MI command

Thanks Torbjörn,

It would be really nice if the extra info came out in the MI stream as a structured MI response. It is possible to parse the OOB message, but it is finicky and other things can be mixed in there too easily, especially when there are pipelined MI messages (like your trace shows). Ideally something like this:

54-stack-info-depth --thread 1 11
55-data-disassemble --thread 1 -s 134223880 -e 134223924 -- 3
&"warning: Could not fetch FPCAR content. Further unwinding of FP register values will be unreliable.\n"
54^done,depth="5",extra-info="warning: Could not fetch FPCAR content. Further unwinding of FP register values will be unreliable."


Jonah Graham
Kichwa Coders

On Thu, 13 Oct 2022 at 07:34, Torbjorn SVENSSON <torbjorn.svensson@xxxxxx> wrote:

Hello all,


Here is an example MI snippet with a warning issued by GDB:


004,691 52-exec-continue --thread 1

004,707 52^running

004,707 *running,thread-id="all"

004,760 53-thread-select 1

004,847 (gdb)

004,847 53^error,msg="Cannot execute this command while the target is running.\nUse the \"interrupt\\

" command to stop the target\nand then try again."

004,847 (gdb)

005,108 =breakpoint-modified,bkpt={number="15",type="breakpoint",disp="keep",enabled="y",addr="0x080\





[message truncated to 5 lines. More lines can be set in the Preference->Debug->GDB eclipse preference page.]

005,108 =breakpoint-modified,bkpt={number="20",type="breakpoint",disp="del",enabled="y",addr="0x0800\





005,478 ~"\n"

005,478 ~"Breakpoint 15, SVC_Handler () at C:/Users/svenssot/STM32Cube/Repository/STM32Cube_FW_F4_V1\


005,478 ~"112\t\t  asm(\"push {r0, r1}\");\n"

005,478 *stopped,reason="breakpoint-hit",disp="keep",bkptno="15",frame={addr="0x08001808",func="SVC_\





005,493 =breakpoint-deleted,id="20"

005,493 54-stack-info-depth --thread 1 11

005,509 55-data-disassemble --thread 1 -s 134223880 -e 134223924 -- 3

006,011 &"warning: Could not fetch FPCAR content. Further unwinding of FP register values will be un\


006,228 54^done,depth="5"

006,228 (gdb)

006,281 56-stack-select-frame --thread 1 0

006,281 57-list-thread-groups

006,281 58-thread-info 1

006,312 55^done,asm_insns=[src_and_asm_line={line="112",file="C:/Users/svenssot/STM32Cube/Repository\




SVC_Handler",offset="4",opcodes="03 b4",inst="push\t{r0, r1}"}]},src_and_asm_line={line="113",file="\

[message truncated to 5 lines. More lines can be set in the Preference->Debug->GDB eclipse preference page.]

006,312 (gdb)

006,312 56^done

006,312 (gdb)

006,381 59-stack-list-frames --thread 1

006,381 57^done,groups=[{id="i1",type="process",pid="42000",executable="C:\\Users\\svenssot\\STM32Cu\



006,381 (gdb)

006,459 58^done,threads=[{id="1",target-id="Thread 1",name="main",frame={level="0",addr="0x08001808"\





006,459 (gdb)

006,459 59^done,stack=[frame={level="0",addr="0x08001808",func="SVC_Handler",file="C:/Users/svenssot\




,frame={level="1",addr="0xffffffe1",func="<signal handler called>"},frame={level="2",addr="0x0800187\

[message truncated to 5 lines. More lines can be set in the Preference->Debug->GDB eclipse preference page.]

006,459 (gdb)



I’ve highlighted MI command that produces the warning message with yellow background color.


So far, I’m only aware of the warning messages that I’ve added and they are not overlapping the registers themselves.


In CDT 10.6.x on Windows, the warning message is printed in the “Debugger console” view, but I’m uncertain how that works on other platforms with the multi-UI support for GDB


In the case of a normal CLI session with GDB, it’s possible to know what frame that caused the problem, but with MI, this context is not available.


Kind regards,




ST Restricted

From: Jonah Graham <jonah@xxxxxxxxxxxxxxxx>
Sent: den 7 oktober 2022 20:14
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx>
Cc: Torbjorn SVENSSON <torbjorn.svensson@xxxxxx>
Subject: Re: [cdt-dev] GDB might send additional message on -stack-info-depth MI command


Hi Torbjörn,


Cool - thanks for getting your ST improvements back into GDB.


What does the MI trace look like in this case? In the case of a warning, I think we should avoid a pop-up. For an unrecoverable error pop-up is probably fine.


Here is my brainstorm idea:


In the warning case, perhaps a warning triangle in the ruler? Like when there is a problem with the breakpoint. The warning triangle can be on the "Debug Current Instruction Pointer" and/or "Debug Call Stack" markers? The advantage of putting it there is that it can have a hover with more information. Maybe having the warning on the call stack itself in the Debug view would be good too.


Does the warning give enough info to know which registers are (possibly?) incorrect? If so, maybe a warning overlay on the registers themselves?


Does the warning/error still come out to CLI when doing the MI command? That means that the Debugger Console view should show it too.


Sounds like a fun one!




Jonah Graham
Kichwa Coders



On Fri, 7 Oct 2022 at 13:34, Torbjorn SVENSSON via cdt-dev <cdt-dev@xxxxxxxxxxx> wrote:


In recent version of GDB (;a=commit;h=60c90d8c6d4b8345b41ab6a0b4d5169d5f78edb3), it's now possible for the stack unwinding to give additional information about the state of the unwind. In some situations, the unwind will be successful, but part of the registers that has been unwinded will have unreliable content.
In CDT, there is a check if the stack unwind was successful or not and if the '-stack-info-depth' command fails, we would simply try again with the '-stack-list-frames' command.

When running the GDB client in command line mode, the warning/error message would be printed to stdout (or stderr). How should we do it in CDT? Open a message box? Any better suggestions?

Here is the code that currently falls back to the '-stack-list-frames' command:

Any pointers is much appreciated.

Kind regards,
cdt-dev mailing list
To unsubscribe from this list, visit

Back to the top