pyocd / pyocd/pyOCD

gdb drops connection (invalid hex digit 120)

Open
#1,000 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug gdbserver
Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

I can't get pyocd gdbserver to work. When I try to connect with arm-none-eabi-gdb, gdb says Reply contains invalid hex digit 120 and drops the connection.
Since debugging the same application with openocd works, I assume the problem is somewhere in pyocd.
The strange thing is that gdb complains about the invalid hex digit when pyocd sends b'$Text=0;Data=0;Bss=0#04' which is a constant so it's not clear to see where this invalid value comes from.

pyocd version is the current dev version (5a52ccc). Full pyocd log is attached.
pyocd.log

$ arm-none-eabi-gdb path/to/application.elf

GNU gdb (GNU Arm Embedded Toolchain 9-2020-q2-update) 8.3.1.20191211-git
Copyright (C) 2019 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=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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 dmmc-stamp-breakout/dmmc-stamp-breakout.elf...
(gdb) tar ext :3333
Remote debugging using :3333
Reply contains invalid hex digit 120
(gdb) 
$ pyocd gdbserver
...
0012986:DEBUG:packet_io:--<<<< GDB send 101 bytes: b'$l<?xml version="1.0"?><!DOCTYPE feature SYSTEM "threads.dtd"><threads><thread id="1" /></threads>#41'
0012987:DEBUG:packet_io:-->>>> GDB read 13 bytes: b'$qAttached#8f'
0012987:DEBUG:gdbserver:GDB received query: [b'Attached#8f']
0012987:DEBUG:packet_io:--<<<< GDB send 5 bytes: b'$1#31'
0012988:DEBUG:packet_io:-->>>> GDB read 8 bytes: b'$Hc-1#09'
0012988:DEBUG:packet_io:--<<<< GDB send 6 bytes: b'$OK#9a'
0012989:DEBUG:packet_io:-->>>> GDB read 12 bytes: b'$qOffsets#4b'
0012989:DEBUG:gdbserver:GDB received query: [b'Offsets#4b']
0012990:DEBUG:packet_io:--<<<< GDB send 23 bytes: b'$Text=0;Data=0;Bss=0#04'
0012991:DEBUG:packet_io:GDB packet thread: other side closed connection
0012991:DEBUG:packet_io:GDB packet thread stopping
0013090:INFO:gdbserver:Client disconnected!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the connection failure with pyocd gdbserver and arm-none-eabi-gdb, using the attached log for the packet exchange. Start in pyocd/gdbserver/gdbserver.py around line 928 and trace the qOffsets response and packet handling. Done means GDB accepts the response and keeps the remote debugging connection open.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.