Menu

#97 Cannot issue GDB monitor commands

Version 1.x
closed
None
5
2015-04-14
2015-01-08
Elijah
No

I am using the latest version (3.1.1.201412191510) of the J-Link Debugging plugin with Eclipse kepler service release 2 (Build id: 20140224-0627). OS is Windows 7 SP1, 32 bit java 8.0.25. I'm using a pre-built version of the GCC Tools for ARM embedded processors, 4.8 2014q2. The JTAG probe is a Segger J-Link Pro.

I'm trying to boot an IMX6Q6 processor. Before code can be loaded into RAM the clocks and DDR controller have to be setup, so I need to issue a bunch of monitor memU32 commands to GDB.

I try to add the monitor commands to the JLink plugin under the 'Debugger' tab in the commands box but when I try to debug, eclipse gives this error:

Error in final launch sequence
Failed to execute MI command:
monitor memU32 0x020e04bc = 0x00000030
Error message from debugger back end:
"monitor" command not supported by this target.
Failed to execute MI command:
monitor memU32 0x020e04bc = 0x00000030
Error message from debugger back end:
"monitor" command not supported by this target.
Failed to execute MI command:
monitor memU32 0x020e04bc = 0x00000030
Error message from debugger back end:
"monitor" command not supported by this target.
"monitor" command not supported by this target.

Monitor of course is supported by GDB and if I bring up GDB in a console, I can issue all my commands successfully.

I tried putting all my commands in a file and then in the plugin's GDB commands box I put "source filename". Now all my commands execute successfully but after the file runs the GDB client closes the connection - the plugin never attempts to download code and run it.

When I still had a bootloader installed on my board that was bringing up the chip, I could attach and debug just fine using the plugin. But now that I try to issue custom GBD commands to configure the DDR controller (can't rely on the bootloader in target hardware), it all falls apart, the plugin just seems to not allow monitor commands. What am I missing?

Discussion

  • Liviu Ionescu (ilg)

    • status: open --> accepted
     
  • Liviu Ionescu (ilg)

    as it is mentioned in the tooltips associated to the GDB Client Setup Commands: field, those commands are executed before connecting to the target, and are intended to the GDB itself, not the target.

    for passing monitor commands to the target, use the fields in the Startup tab.

    since there were some changes to the J-Link plug-in, I advice you to use the latest beta, available from updates-test.

    you need first to understand the relationship between the interface elements and the commands sent to the target. for this, the 'gdb traces' console is of great help.

     

    Last edit: Liviu Ionescu (ilg) 2015-01-08
  • Elijah

    Elijah - 2015-01-09

    Thank you for your quick response, I did not notice the tooltip before. I just created a .gdbinit file and put my commands in there, that seems to be working.

    However now I get the following in the GBD traces console (I abbreviated the beginning part but everything looks good and all commands succeed):

    847,769 @"Writing 0xF00000CF @ address 0x020E0010\r\n"
    847,771 @"Writing 0x007F007F @ address 0x020E0018\r\n"
    847,773 @"Writing 0x007F007F @ address 0x020E001C\r\n"
    847,774 @"Writing 0x000000FB @ address 0x020C4060\r\n"
    847,774 11^done
    847,774 (gdb)
    847,775 12^error,msg="Can not fetch data now."
    847,775 (gdb)
    847,775 13^done,groups=[{id="i1",type="process",pid="42000"}]
    847,775 (gdb)
    847,775 14-gdb-set auto-solib-add on
    847,785 14^done
    847,785 (gdb)
    847,970 15-list-thread-groups i1
    847,970 16-target-select remote localhost:2331

    847,977 15^done,threads=[{id="1",target-id="Thread

    <main>",frame={level="0",addr="0x00000000",func="\
    ??",args=[]},state="stopped"}]
    847,977 (gdb)
    847,977 =thread-group-exited,id="i1"
    847,989 =thread-group-started,id="i1",pid="42000"
    847,989 =thread-created,id="1",group-id="i1"
    847,989 17-gdb-exit
    847,989 18-list-thread-groups --available
    847,989 19-stack-info-depth --thread 1 11
    847,998 *stopped,frame={addr="0x00000fb8",func="??",args=[]},thread-id="1",stopped-threads="all"
    847,998 16^connected
    847,999 (gdb)
    847,999 &"\n"
    847,999 ^done
    847,999 (gdb)
    847,999 17^exit
    848,000 =thread-group-exited,id="i1"

    Error cannot fetch data, how do I know what/were it was trying to fetch or what would cause this? Looking at the GDB Server console, it reads all registers successfully and then the conneciton is closed:

    Writing 0x007F007F @ address 0x020E0018
    Writing 0x007F007F @ address 0x020E001C
    Writing 0x000000FB @ address 0x020C4060
    Read 4 bytes @ address 0x00000000 (Data = 0xE59FF01C)
    GDB closed TCP/IP connection
    Connected to 127.0.0.1
    Reading all registers
    Read 4 bytes @ address 0x00000FB8 (Data = 0xF8D12000)
    GDB closed TCP/IP connection

    You obviously understand this plugin well, do you have any ideas as to what might be causing this? The GDB console is empty...

    </main>
     
  • Liviu Ionescu (ilg)

    a .gdbinit file

    generally a bad idea

    Error cannot fetch data,

    I occasionally saw this message, but had no time to investigate. if the configuration is functional, I would not be very worried.

     
  • Elijah

    Elijah - 2015-01-09

    Put them in the "initialization commands" box instead of .gdbinit? It does not function, as you can see it closes the GDB connection and never tries to download code.

     
    • Liviu Ionescu (ilg)

      I think the interface allows any possible combination of commands, before and after loading the file.

      at the limit you can disable all built in commands and put everything in the big boxes.

       
  • Elijah

    Elijah - 2015-01-09

    Oops that was probably caused by an errant target remote call in my .gdbinit, after removing that it does download code but as soon as it tries to set a breakpoint at main() it gets an error, Cannot access memory at address 0x10006464. My init script may be incorrect in some way, that address is near the beginning of DDR.

     
    • Liviu Ionescu (ilg)

      to see the exact commands passed to the server, in their order, check the gdb trace console.

       
  • Liviu Ionescu (ilg)

    did you figure out how to configure the debug plug-ins?

     
  • Elijah

    Elijah - 2015-02-11

    Yes I did, thanks for following up. I wound up just putting 'source gdbinit.cfg' in the initialization commands box. That file contains all the gdb commands to setup DDR memory and the clocks and so forth.

    Only things I haven't figured out is why the 'reset target and restart debugging' button doesn't work, it just says "The selected operation is not enabled". It would be nice to be able to jump back to main() without having to do a hard reset and redownload code into RAM, is there a way to enable this button to do that?

     
  • Liviu Ionescu (ilg)

    unfortunately not. but you can completely overwrite the entire initialisation dialog and write your custom sequence.

     
  • Liviu Ionescu (ilg)

    • status: accepted --> closed
     
MongoDB Logo MongoDB