This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GDB Agent verbose mode

Other Parts Discussed in Thread: CC2538

Hi,

i am trying to work with GDB Agent from XDS Emulation Software package and GDB for ARM.  Is it possible to start the GDB Agent (GUI/Console) in verbose mode to see the commands send by the GDB to the GDB Agent and how GDB Agent interprets&responds?

Do we also have the list of supported GDB commands on the agent?

  • Hi,

    I haven't used the GDB Agent for XDS emulators yet, therefore I could not experiment with its options and features. However, the app note below describes the setup procedures in its section 5.2:

    http://www.ti.com/lit/an/swra443/swra443.pdf

    In the tab "Debugger" there is a check box that enables the Verbose Console mode. Can you give this a try and see if it enables the messages at the verbosity level you are looking for?

    Hope this helps,

    Rafael

  • Rafael,

    thanks for the reply. I am aware of the app note swra443, in fact i am using it as reference to debugging CC2538 on SmartRF06EB using Code::Blocks IDE. I am having trouble with Eclipse, and i switched to Code::Blocks because it is more light weight.

    Do you have the list of supported GDB commands by the GDB Agent for XDS Emulator? If i for example try to execute "run" commands, the GDB reports back that it is not supported by the debugger.

    > run

    [debug]> run
    [debug]The "remote" target does not support "run". Try "help target" or "continue".
    [debug]>>>>>>cb_gdb:

    The "remote" target does not support "run". Try "help target" or "continue".

  • Leo,

    Unfortunately I don't have such list, but did you try the suggestions mentioned in the error message? What do you get?

    Also, "run" may also be shorted to simply "r". You could try that, as the underlying software may support only the short form versions of certain commands for performance reasons (that is a wild guess on my part, but it may work).

    Regards,

    Rafael

  • Rafael,

    can you forward this to the team who make the XDS Emulation Package?

    I made some further research, it seems that the GDB Agent works only with GDB MI (Machine Interface) interpreter. Is this correct?

    If i try to connect using command line gdb, i retrieved this:

    (gdb)
    target remote localhost:55000
    &"target remote localhost:55000\n"
    ~"Remote debugging using localhost:55000\n"
    ~"Ignoring packet error, continuing...\n"
    &"warning: unrecognized item \"timeout\" in \"qSupported\" response\n"
    ~"Ignoring packet error, continuing...\n"
    ~"Ignoring packet error, continuing...\n"
    ~"Ignoring packet error, continuing...\n"
    ~"Ignoring packet error, continuing...\n"
    ~"Ignoring packet error, continuing...\n"
    =thread-group-started,id="i1",pid="42000"
    =thread-created,id="1",group-id="i1"
    ~"Ignoring packet error, continuing...\n"
    =thread-group-exited,id="i1"
    &"Malformed response to offset query, timeout\n"
    ^error,msg="Malformed response to offset query, timeout"

    While on the GDB Agent, i see the following error:

    C) Copyright 2012 by Texas Instruments Incorporated.
    Please configure connection and start agent for a selected target.
    Successfully configured C:\Work\gdb_cc2538\CC2538_XDS100v3c2.dat
    cortex_m3_0 - GDB server agent successfully started.
    cortex_m3_0          Waiting for client
    cortex_m3_0          Client connected
    Connecting to target
    FAILED! GTI_CONNECT(hpid=04F01240)=-1
    (Error -6306) Failed to connect to PRSC module.
    (Emulation package 5.1.402.0)
    Failed to connect to target...exiting

    Do you know what's wrong?

  • Leo,

    GDB agent supports a subset of the GDB RSP.   Theoretically any GDB client that can be configured to use the RSP could potentially work - though in practice its usually not that easy.

    In this particular case one problem appears to be that the target connection failed.  It also appears that the format of the responses by the agent do not match with the format the client is expecting.  I wouldn't be suprised to find there are some derivations in the protocol.

    To the second point the agent can be set up to display all client/agent traffic  by setting the environment variable '.GDB_AGENT_DISPLAY_LEVEL=6. before running. 

    As for the connection issue, can you send me the board data file you are using.  I will try it out here.

    -Craig

  • Leo,

    Which gdb are you using?  I was able to use the GDB agent successfully with the cc2538 through the arm-none-linux-gnueabi-gdb.exe from CodeSourcery.  I used the attached board.dat file.

    Regards,

    Craig

    0336.cc2538.dat

  • Hi Craig,

    i am using the GDB from this ARM GNU Toolchain: https://launchpad.net/gcc-arm-embedded.

    Could you share how do you do it via the command line?

    e.g. which parameter to be invoked when calling gdb, any preliminary commands before executing "target remote localhost:55000" command, etc.?

  • I downloaded this toolchain and tried it with bin/arm-none-eabi-gdb.  The first time I tried it I saw the same timeout error you reported and the overall behavior was similar.  Curiously when I tried the remote connect from the same GDB session again it worked.   I also managed to get it to work the first time by increasing the remote timeout.

    Start the GDB server using the board data file I provided in the previous response.  

    > gdb_agent_console cc2538.dat

    Start GDB., cnfigure the remote timeout and connect to the GDB server (localhost is default).

    (gdb) set remotetimeout 20

    (gdb) target remote :55000

     

    Let me know if this helps.

    Craig

  • Craig,

    thanks for the hints. The connection seems to work, however i can't make basic commands such as setting breakpoints to work.

    Here are the logs:

    GDB side:

    $ arm-none-eabi-gdb.exe blink_led.elf
    GNU gdb (Sourcery CodeBench 2013.11-50) 7.6.50.20130726-cvs
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "--host=i686-mingw32 --target=arm-none-eabi".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <https://sourcery.mentor.com/GNUToolchain/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from c:\work\gdb_cc2538\blink_led.elf...done.
    (gdb) set remotetimeout 20
    (gdb) target remote localhost:55000
    Remote debugging using localhost:55000
    0x00200352 in main () at main.c:62
    62              for(ulLoopCount = 200000; ulLoopCount > 0; ulLoopCount--)
    (gdb) break 59
    Breakpoint 1 at 0x200326: file main.c, line 59.
    (gdb) continue
    Continuing.
    Warning:
    Cannot insert breakpoint 1.
    Error accessing memory address 0x200326: (undocumented errno -1).
    (gdb)
    GDB Agent:
    C:\ti\ccs_base\common\uscif>set GDB_AGENT_DISPLAY_LEVEL=6
    C:\ti\ccs_base\common\uscif>gdb_agent_console.exe C:\Work\gdb_cc2538\cc2538.dat
    Loaded C:\ti\ccs_base\common\uscif\..\..\\emulation\drivers\\tixds510cortexm.dvr
    .
    Successfully configured C:\Work\gdb_cc2538\cc2538.dat
    CPU Name             Port
    --------             ----
    cortex_m3_0         :55000
    Starting all cores
    CPU Name             Status
    --------             ------
    cortex_m3_0          Waiting for client
    cortex_m3_0          Client connected
    Connecting to target
    cortex_m3_0 - Processor type =CORTEX_MXX (Little endian)
    cortex_m3_0 - Target device is connected
    cortex_m3_0 - Target device halted because of user request
    cortex_m3_0 - General Capabilities=0x11da041b
    cortex_m3_0 - Emulation Capabilities=0x17
    Calling ctools Get cToolsManager
    Calling ctools Get Job Mgr
    Target connected
    >>>> %+$qSupported:multipr...
    <<<< +
    <<<< $QStartNoAckMode+;PacketSize=3f0#0f
    >>>> %+$QStartNoAckMode#b0
    <<<< +
    <<<< $OK#9a
    >>>> %+$Hg0#df
    <<<< $OK#00
    >>>> %$qTStatus#49
    <<<< $#00
    >>>> %$?#3f
    <<<< $T050f:52032000;#00
    >>>> %$Hc-1#09
    <<<< $OK#00
    >>>> %$qC#b4
    <<<< $QC0#00
    >>>> %$qAttached#8f
    <<<< $1#00
    >>>> %$qOffsets#4b
    <<<< $#00
    >>>> %$Hg0#df
    <<<< $OK#00
    >>>> %$g#67
    <<<< $0002002000020020000000009bbc0000000000000000000000000000000000000000000000
    000000000000000000000000000000e8010020f702200052032000#00
    >>>> %$m200352,4#f9
    <<<< $00657800#00
    >>>> %$g#67
    <<<< $0002002000020020000000009bbc0000000000000000000000000000000000000000000000
    000000000000000000000000000000e8010020f702200052032000#00
    >>>> %$qSymbol::#5b
    <<<< $OK#00
    >>>> %$m200302,2#f2
    <<<< $4f00#00
    >>>> %$m200326,2#f8
    <<<< $4b00#00
    >>>> %$Z0,200326,2#41
    FAILED! GTI_SETBP_EX(hpid=02911240,addr=0x200326,type=0,count=1,access=0)=ffffff
    ff
    (Error -1066 @ 0x200326)
    Unable to set/clear requested breakpoint. Verify that the breakpoint address is
    in valid memory.
    (Emulation package 5.1.402.0)
    ERROR: set_breakpoint() backend call returned 64
    <<<< $E16#00
    Do you know what could go wrong here? FYI I am using the Mentor's ARM GCC toolchain to compile the blink LED example from the CC2538 GDB app note http://www.ti.com/lit/an/swra443/swra443.pdf

     

  • Leo, Craig,

    One detail that caught my eye: this address is in Flash memory, therefore it is possible you need to use Hardware breakpoints - I am almost 100% sure GDB uses software breakpoints by default.

    I am unsure how to make this setting or even if it is supported in GDB, but it is surely worth trying.

    Regards,

    Rafael

     

  • I believe the GDB command for hardware breakpoints is 'hbreak', but unfortunatly I don't think it is currently supported by the GDB agent  - at least for the cortex M3.  I think the underlying software supports it, so it is probably just a matter of making the connection in the agent.  I'll see what I can do and let you know.

    Were you purposely trying to set breakpoints in flash?

  • Hi Craig, 

    basically i just want to try making the code debugging works for CC2538 with GDB which is compiled using ARM GCC. I think in most cases the code will be stored in Flash, so i believe this means i need to be able to use hardware breakpoint.

  • Hi Craig,

    maybe we need to get back to my first questions: do you have the list of GDB command supported by the XDS GDB agent? From your last reply, it seems that the problem is basically because "hbreak" command is not supported by the XDS GDB Agent for Cortex M3 processors.

  • Leo,

    I was wrong.  I verified that hardware breakpoints are working for the Cortex M3.   The GDB keyword for setting hardware breakponts is 'hbreak'.  

    You should be able to do any type of basic stop-mode debug through the GDB agent.  It supports the RSP protocol primitives that required by GDB.  The task-aware debug support in the GDB RSP protocol is not implemented in the GDB agent however, meaning the agent itself does not support Linux application debug.  Of course if you are doing Linux application debug you probably would be running a GDB server anyhow.