[SOLVED] JLinkGDBServer issues with 6.44d

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

  • [SOLVED] JLinkGDBServer issues with 6.44d

    When trying to run JLinkGDBServerCLExe on Linux I run into an issue when connecting with GDB.

    I've started the server with the following arguments:
    JLinkGDBServerCLExe -device mcimx6g2 -speed 20000

    However when I try to connect with gdb, I get the following error:
    (gdb) target remote :2331
    Remote debugging using :2331
    warning: while parsing target description: XML declaration not well-formed
    warning: Could not load XML target description; ignoring
    Remote 'g' packet reply is too long (expected 168 bytes, got 308 bytes): 00000000300a90000000001000080000000000000001000000800d02000002020001000000000000000000000000000014000e0264ff91004b2f00007a850000f3010040d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d3010000d30100000001000000000000000000000000000014000e02bfa2a87a823250a0212a6e4e13e228a43ef96346bee8237c0384054223ff4f6f8a05d0935cf3086b177d80601e76aa40e34301a164ff91004b2f0000d301000054e1b5cff739a0b2ea9904f61f3303fe41ec290cfabb0b1f

    This works fine with 6.44c.

    The GDB in use is GNU gdb (GDB) 8.2.1 for the arm-none-eabi platform on Arch Linux.
  • I ran into this same problem in version 6.44d last week and found a workaround. I've been meaning to file a bug report. It's good to know it's a regression. I haven't used a J-Link in a while, so I started with version 6.44d.

    I am running JLinkGDBServer on Linux (Ubuntu 16.04), with a slightly different iMX6 chip (MCIMX6S6):
    JLinkGDBServer -device MCIMX6S6 -endian little -if JTAG -speed 1000

    Start GDB. I'm using GDB 8.0 built with my Yocto SDK.
    ${GDB} -d ~/work/u-boot/ ~/work/u-boot/u-boot

    The problem is correctly reported in this error message:
    warning: while parsing target description: XML declaration not well-formed

    So, enable xml parse debugging:
    set debug xml

    (At first I didn't know about set debug xml, but I found that set debug target 2 would print a hex dump of the xml file and then I could use xxd -r to get the text. set debug xml is easier.)


    Here's what I get when I connect:

    Source Code

    1. (gdb) target remote localhost:2331
    2. Remote debugging using localhost:2331
    3. target description (line 1): Starting:
    4. <?xml version=\"1.0\"?>
    5. <!-- Copyright (C) 2008 Free Software Foundation, Inc. -->
    6. <!-- Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. -->
    7. <!-- SEGGER: Add new registers only after the "SEGGER START" section in the xml file, to make sure we never get incompatible to the GDB register stream -->
    8. <!DOCTYPE feature SYSTEM \"gdb-target.dtd\">
    9. <target>
    10. <architecture>arm</architecture>
    11. <feature name=\"org.gnu.gdb.arm.core\">
    12. <reg name=\"r0\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    13. <reg name=\"r1\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    14. <reg name=\"r2\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    15. <reg name=\"r3\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    16. <reg name=\"r4\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    17. <reg name=\"r5\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    18. <reg name=\"r6\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    19. <reg name=\"r7\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    20. <reg name=\"r8\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    21. <reg name=\"r9\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    22. <reg name=\"r10\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    23. <reg name=\"r11\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    24. <reg name=\"r12\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    25. <reg name=\"sp\" bitsize=\"32\" type=\"data_ptr\" group=\"general\"/>
    26. <reg name=\"lr\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    27. <reg name=\"pc\" bitsize=\"32\" type=\"code_ptr\" group=\"general\"/>
    28. <reg name=\"cpsr\" bitsize=\"32\" type=\"uint32\" group=\"general\"/>
    29. </feature>
    30. <feature name=\"org.gnu.gdb.arm.vfp\">
    31. <reg name=\"fpscr\" bitsize=\"32\" type=\"uint32\" group=\"float\"/>
    32. <reg name=\"d0\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    33. <reg name=\"d1\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    34. <reg name=\"d2\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    35. <reg name=\"d3\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    36. <reg name=\"d4\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    37. <reg name=\"d5\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    38. <reg name=\"d6\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    39. <reg name=\"d7\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    40. <reg name=\"d8\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    41. <reg name=\"d9\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    42. <reg name=\"d10\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    43. <reg name=\"d11\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    44. <reg name=\"d12\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    45. <reg name=\"d13\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    46. <reg name=\"d14\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    47. <reg name=\"d15\" bitsize=\"64\" type=\"ieee_double\" group=\"float\"/>
    48. </feature>
    49. <feature name=\"segger.core.mode\">
    50. <reg name=\"r8_usr\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    51. <reg name=\"r9_usr\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    52. <reg name=\"r10_usr\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    53. <reg name=\"r11_usr\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    54. <reg name=\"r12_usr\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    55. <reg name=\"r13_usr\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    56. <reg name=\"r14_usr\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    57. <reg name=\"r8_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    58. <reg name=\"r9_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    59. <reg name=\"r10_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    60. <reg name=\"r11_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    61. <reg name=\"r12_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    62. <reg name=\"r13_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    63. <reg name=\"r14_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    64. <reg name=\"spsr_fiq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    65. <reg name=\"r13_irq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    66. <reg name=\"r14_irq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    67. <reg name=\"spsr_irq\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    68. <reg name=\"r13_svc\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    69. <reg name=\"r14_svc\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    70. <reg name=\"spsr_svc\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    71. <reg name=\"r13_abt\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    72. <reg name=\"r14_abt\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    73. <reg name=\"spsr_abt\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    74. <reg name=\"r13_und\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    75. <reg name=\"r14_und\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    76. <reg name=\"spsr_und\" bitsize=\"32\" type=\"uint32\" group=\"mode\"/>
    77. </feature>
    78. <!-- SEGGER START -->
    79. </target>
    80. warning: while parsing target description: XML declaration not well-formed
    81. warning: Could not load XML target description; ignoring
    82. Remote 'g' packet reply is too long: 0000000000000000b400020200000080148ffd1f0000000001000000a15cfc1fefbeaddeefbeaddeefbeaddeefbeaddeefbeaddeefbeaddeefbeadde0000000000000000182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c8017182c80173415fd1fb8de581fa15cfc1f01000000c88bfd1f000000000000000000000000000000000000000000000000000000000000000000000000cd0800fd0000000000000000ef0808ac8061581fcdd1f91ffd030d7100000000000000005c2209f4000000000000000038f00000
    Display All
    So we can see there are extra quote escapes passed to GDB which don't need to be there.

    Removing them fixes the issue, but you have to point GDB to the new XML first. Edit the file (replace all \" with " and save to tdesc.xml or a more descriptive name about your target).

    Point GDB to the new XML:
    set tdesc filename ~/work/tdesc.xml

    Reconnecting to the JLink server should work now:
    target remote localhost:2331

    The post was edited 1 time, last by remington ().

  • Side note about the issue, I tried to use xmllint to check the tdesc.xml file after I edited it. Strangely, it seems the DTD file from GDB itself had errors. Maybe I'm using the tool wrong. I have little interest in debugging that issue, but thought I'd share my notes.

    xmllint can be installed with the libxml2-utils package on Debian based systems:
    sudo apt-get install libxml2-utils

    Here's what I get:

    Source Code

    1. $ xmllint --nonet --path /home/remington/tools/gdb/8.0-r0/gdb-8.0/gdb/features --valid gdb-target.dtd ~/work/tdesc.xml
    2. /home/remington/tools/gdb/8.0-r0/gdb-8.0/gdb/features/gdb-target.dtd:12: parser error : StartTag: invalid element name
    3. <!ELEMENT target (architecture?, osabi?, compatible*, feature*)>
    4. ^
    5. /home/remington/tools/gdb/8.0-r0/gdb-8.0/gdb/features/gdb-target.dtd:12: parser error : Extra content at the end of the document
    6. <!ELEMENT target (architecture?, osabi?, compatible*, feature*)>
    7. ^
    8. /home/remington/work/tdesc.xml:6: element target: validity error : root and DTD name do not match 'target' and 'feature'
    9. <target>
    10. ^
    11. <?xml version="1.0"?>
    12. <!-- Copyright (C) 2008 Free Software Foundation, Inc. -->
    13. <!-- Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. -->
    14. <!-- SEGGER: Add new registers only after the "SEGGER START" section in the xml file, to make sure we never get incompatible to the GDB register stream -->
    15. <!DOCTYPE feature SYSTEM "gdb-target.dtd">
    16. <target>
    17. <architecture>arm</architecture>
    18. <feature name="org.gnu.gdb.arm.core">
    19. <reg name="r0" bitsize="32" type="uint32" group="general"/>
    20. <reg name="r1" bitsize="32" type="uint32" group="general"/>
    21. <reg name="r2" bitsize="32" type="uint32" group="general"/>
    22. <reg name="r3" bitsize="32" type="uint32" group="general"/>
    23. <reg name="r4" bitsize="32" type="uint32" group="general"/>
    24. <reg name="r5" bitsize="32" type="uint32" group="general"/>
    25. <reg name="r6" bitsize="32" type="uint32" group="general"/>
    26. <reg name="r7" bitsize="32" type="uint32" group="general"/>
    27. <reg name="r8" bitsize="32" type="uint32" group="general"/>
    28. <reg name="r9" bitsize="32" type="uint32" group="general"/>
    29. <reg name="r10" bitsize="32" type="uint32" group="general"/>
    30. <reg name="r11" bitsize="32" type="uint32" group="general"/>
    31. <reg name="r12" bitsize="32" type="uint32" group="general"/>
    32. <reg name="sp" bitsize="32" type="data_ptr" group="general"/>
    33. <reg name="lr" bitsize="32" type="uint32" group="general"/>
    34. <reg name="pc" bitsize="32" type="code_ptr" group="general"/>
    35. <reg name="cpsr" bitsize="32" type="uint32" group="general"/>
    36. </feature>
    37. <feature name="org.gnu.gdb.arm.vfp">
    38. <reg name="fpscr" bitsize="32" type="uint32" group="float"/>
    39. <reg name="d0" bitsize="64" type="ieee_double" group="float"/>
    40. <reg name="d1" bitsize="64" type="ieee_double" group="float"/>
    41. <reg name="d2" bitsize="64" type="ieee_double" group="float"/>
    42. <reg name="d3" bitsize="64" type="ieee_double" group="float"/>
    43. <reg name="d4" bitsize="64" type="ieee_double" group="float"/>
    44. <reg name="d5" bitsize="64" type="ieee_double" group="float"/>
    45. <reg name="d6" bitsize="64" type="ieee_double" group="float"/>
    46. <reg name="d7" bitsize="64" type="ieee_double" group="float"/>
    47. <reg name="d8" bitsize="64" type="ieee_double" group="float"/>
    48. <reg name="d9" bitsize="64" type="ieee_double" group="float"/>
    49. <reg name="d10" bitsize="64" type="ieee_double" group="float"/>
    50. <reg name="d11" bitsize="64" type="ieee_double" group="float"/>
    51. <reg name="d12" bitsize="64" type="ieee_double" group="float"/>
    52. <reg name="d13" bitsize="64" type="ieee_double" group="float"/>
    53. <reg name="d14" bitsize="64" type="ieee_double" group="float"/>
    54. <reg name="d15" bitsize="64" type="ieee_double" group="float"/>
    55. </feature>
    56. <feature name="segger.core.mode">
    57. <reg name="r8_usr" bitsize="32" type="uint32" group="mode"/>
    58. <reg name="r9_usr" bitsize="32" type="uint32" group="mode"/>
    59. <reg name="r10_usr" bitsize="32" type="uint32" group="mode"/>
    60. <reg name="r11_usr" bitsize="32" type="uint32" group="mode"/>
    61. <reg name="r12_usr" bitsize="32" type="uint32" group="mode"/>
    62. <reg name="r13_usr" bitsize="32" type="uint32" group="mode"/>
    63. <reg name="r14_usr" bitsize="32" type="uint32" group="mode"/>
    64. <reg name="r8_fiq" bitsize="32" type="uint32" group="mode"/>
    65. <reg name="r9_fiq" bitsize="32" type="uint32" group="mode"/>
    66. <reg name="r10_fiq" bitsize="32" type="uint32" group="mode"/>
    67. <reg name="r11_fiq" bitsize="32" type="uint32" group="mode"/>
    68. <reg name="r12_fiq" bitsize="32" type="uint32" group="mode"/>
    69. <reg name="r13_fiq" bitsize="32" type="uint32" group="mode"/>
    70. <reg name="r14_fiq" bitsize="32" type="uint32" group="mode"/>
    71. <reg name="spsr_fiq" bitsize="32" type="uint32" group="mode"/>
    72. <reg name="r13_irq" bitsize="32" type="uint32" group="mode"/>
    73. <reg name="r14_irq" bitsize="32" type="uint32" group="mode"/>
    74. <reg name="spsr_irq" bitsize="32" type="uint32" group="mode"/>
    75. <reg name="r13_svc" bitsize="32" type="uint32" group="mode"/>
    76. <reg name="r14_svc" bitsize="32" type="uint32" group="mode"/>
    77. <reg name="spsr_svc" bitsize="32" type="uint32" group="mode"/>
    78. <reg name="r13_abt" bitsize="32" type="uint32" group="mode"/>
    79. <reg name="r14_abt" bitsize="32" type="uint32" group="mode"/>
    80. <reg name="spsr_abt" bitsize="32" type="uint32" group="mode"/>
    81. <reg name="r13_und" bitsize="32" type="uint32" group="mode"/>
    82. <reg name="r14_und" bitsize="32" type="uint32" group="mode"/>
    83. <reg name="spsr_und" bitsize="32" type="uint32" group="mode"/>
    84. </feature>
    85. <!-- SEGGER START -->
    86. </target>
    Display All