Setting breakpoint using monitor setbp from gdb doesn't update gdb breakpoint list.

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Setting breakpoint using monitor setbp from gdb doesn't update gdb breakpoint list.

    Hi,

    I am trying to set a breakpoint by using jlink gdbserver monitor command from gdb :

    monitor setbp <Address>

    The jlink gdbserver shows that the breakpoint has been set but doing "info b" in gdb doesn't show the breakpoint. Also if I continue the program execution by using "monitor go" then gdb never hits that breakpoint or in other words gdb doesn't get any notifications about monitor commands actions. Is this expexted ?
    If yes then how should I use monitor commands such that gdb knows about the status.

    Also if I set my "pc" using monitor reg pc = 0x..... , the gdbserver shows me that the pc has been set to the new address but doing a "info registers" from gdb doesn't update the pc value. I am really confused. Plz help.
  • Hello,

    Using the monitor commands will not do any update in GDB.
    The command is simply passed to GDB Server and GDB receives only a string response like "Writing register (PC = 0x...)".

    Therefore monitor commands which interferer with the debug debugging behavior (breakpoints, go, halt)
    and require some state update in GDB
    should only be used when this cannot be issued with a native GDB command.

    So instead of "monitor go" "countinue" should be used, "break" instead of "monitor setbp" and "set $pc" instead of "monitor reg pc".

    Best regards
    Johannes
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • So is it correct to use "monitor halt" instead of issuing a "ctrl+c" from gdb as currently if I issue a ctrl+c command I get an error on jlinkgdbserver saying that could not halt the core, but doing monitor halt seems to work fine....

    "GDB receives only a string response like "Writing register (PC = 0x...)"

    In my case the monitor commands don't seem to return any output to gdb. Though the JLinkGDBServer does show a message. What I get on my gdb is simply an OK packet after setting : set debug remote 1.


    Please comment. Am I missing something ?


    Thanks.
  • So is it correct to use "monitor halt" instead of issuing a "ctrl+c"
    from gdb as currently if I issue a ctrl+c command I get an error on
    jlinkgdbserver saying that could not halt the core, but doing monitor
    halt seems to work fine....
    Sounds strange. Issuing Ctrl-C should work, too. Which version of GDB and GDB Server are you using and which target device?
    Normally monitor halt should not be used.



    "GDB receives only a string response like "Writing register (PC = 0x...)"



    In my case the monitor commands don't seem to return any output to gdb.
    Though the JLinkGDBServer does show a message. What I get on my gdb is
    simply an OK packet after setting : set debug remote 1.





    Please comment. Am I missing something ?
    No, you are not. Some monitor commands do not send any response, so everything is fine if you do not get an error.

    Regards
    Johannes
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thanks for the clarification. I am attaching gdbserver.png that shows the response of JLinkGDBServerCL 4.96g on issuing a ctrl+c command. The target never comes to a halt.
    Images
    • gdbserver.png

      67.3 kB, 679×346, viewed 651 times
  • The screenshot shows you are starting GDB Server without configuration.
    I am not sure what target device you are using, but it is mandatory to tell GDB Server.

    Could you try starting GDB Server the following way:
    jlinkgdbservercl.exe -device <YourDeviceName> -if JTAG -speed 1000 (e.g. jlinkgdbservercl.exe -device STM32F407IE -if JTAG -speed 1000)

    Regards
    Johannes
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.