Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
a5b855ca
Commit
a5b855ca
authored
Mar 20, 2018
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug: add detach, and poll for interrupt.
parent
419fd63d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
mockturtle-debug.py
software/tools/mockturtle-debug.py
+20
-4
No files found.
software/tools/mockturtle-debug.py
View file @
a5b855ca
...
...
@@ -3,6 +3,7 @@ import PyUAL
import
getopt
,
sys
import
time
import
socket
import
select
import
struct
gdb_port
=
3000
...
...
@@ -195,6 +196,7 @@ class GdbServer(object):
self
.
dap
=
dap
self
.
port
=
port
self
.
conn
=
None
self
.
packet_size
=
2048
self
.
term
=
(
flag_term
and
self
.
dap
.
csr
.
readl
(
CSR_CORESEL
)
==
self
.
dap
.
cpu
)
if
not
self
.
term
:
...
...
@@ -276,9 +278,12 @@ class GdbServer(object):
sys
.
stdout
.
flush
()
timeout
=
1
# FIXME: ^C handling is not reliable (can happen anywhere).
stop
=
False
try
:
time
.
sleep
(
timeout
/
1000.0
)
(
r
,
w
,
x
)
=
select
.
select
([
self
.
conn
],
[],
[],
timeout
/
1000.0
)
except
KeyboardInterrupt
:
stop
=
True
if
stop
or
self
.
conn
in
r
:
self
.
force_debug
()
self
.
send
(
'S02'
)
return
...
...
@@ -287,6 +292,11 @@ class GdbServer(object):
elif
timeout
<
100
:
timeout
+=
10
self
.
send
(
'S05'
)
def
handle_D
(
self
,
packet
):
# Detach
self
.
dap
.
exec_insn
(
0x00100073
)
# ebreak
self
.
send
(
'OK'
)
def
handle_g
(
self
,
packet
):
# Serious work: read all registers.
...
...
@@ -398,7 +408,7 @@ class GdbServer(object):
self
.
send
(
''
)
def
handle_q_supported
(
self
,
packet
):
self
.
send
(
'
'
)
self
.
send
(
'
PacketSize={:x}'
.
format
(
self
.
packet_size
)
)
def
handle_q
(
self
,
packet
):
if
packet
.
startswith
(
'qSupported:'
):
...
...
@@ -483,7 +493,7 @@ class GdbServer(object):
while
True
:
# Wait for a packet
packet
=
""
data
=
self
.
conn
.
recv
(
2048
)
data
=
self
.
conn
.
recv
(
self
.
packet_size
)
# Exit in case of disconnection
if
len
(
data
)
==
0
:
break
...
...
@@ -491,8 +501,14 @@ class GdbServer(object):
if
len
(
packet
)
==
0
:
if
c
==
'$'
:
packet
=
c
else
:
elif
c
==
'+'
:
# Ignore ack to answers.
pass
elif
c
==
'
\x03
'
:
print
"Got a break!"
else
:
if
flag_verbose
:
print
"Ignore character {:x}"
.
format
(
ord
(
c
))
else
:
packet
+=
c
if
len
(
packet
)
>
3
and
packet
[
-
3
]
==
'#'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment