Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
ba877b63
Commit
ba877b63
authored
Jan 19, 2010
by
hjk
Browse files
debugger: prepare for outputting breakpoints from the dumpers
parent
fa2f73aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/gdbmacros/dumper.py
View file @
ba877b63
...
...
@@ -59,6 +59,110 @@ def parseAndEvaluate(exp):
gdb
.
execute
(
"set logging off"
)
return
gdb
.
history
(
0
)
class
Breakpoint
:
def
__init__
(
self
):
self
.
number
=
None
self
.
filename
=
None
self
.
linenumber
=
None
self
.
address
=
[]
self
.
function
=
None
self
.
fullname
=
None
self
.
condition
=
None
self
.
times
=
None
def
listOfBreakpoints
(
d
):
file
=
tempfile
.
mkstemp
(
prefix
=
"gdbpy_"
)
filename
=
file
[
1
]
gdb
.
execute
(
"set logging off"
)
gdb
.
execute
(
"set logging redirect off"
)
gdb
.
execute
(
"set logging file %s"
%
filename
)
gdb
.
execute
(
"set logging redirect on"
)
gdb
.
execute
(
"set logging on"
)
gdb
.
execute
(
"info break"
)
gdb
.
execute
(
"set logging off"
)
gdb
.
execute
(
"set logging redirect off"
)
# [bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
#addr="0x0804da6d",func="testHidden()",file="../app.cpp",
#fullname="...",line="1292",times="1",original-location="\"app.cpp\":1292"},
# Num Type Disp Enb Address What\n"
#1 breakpoint keep y 0x0804da6d in testHidden() at app.cpp:1292
#\tbreakpoint already hit 1 time
#2 breakpoint keep y 0x080564d3 in espace::..doit(int) at ../app.cpp:1210\n"
#3 breakpoint keep y <PENDING> \"plugin.cpp\":38\n"
#4 breakpoint keep y <MULTIPLE> \n"
#4.1 y 0x08056673 in Foo at ../app.cpp:126\n"
#4.2 y 0x0805678b in Foo at ../app.cpp:126\n"
#5 hw watchpoint keep y &main\n"
file
=
open
(
filename
,
"r"
)
lines
=
[]
for
line
in
file
:
if
len
(
line
)
==
0
or
line
.
startswith
(
" "
):
continue
lines
.
append
(
line
)
file
.
close
()
os
.
remove
(
filename
)
lines
.
reverse
()
bp
=
Breakpoint
()
for
line
in
lines
:
if
line
[
0
]
<
'0'
or
line
[
0
]
>
'9'
:
continue
if
line
.
startswith
(
"
\t
stop only if "
):
bp
.
condition
=
line
[
14
:]
continue
if
line
.
startswith
(
"
\t
breakpoint already hit "
):
bp
.
times
=
line
[
24
:]
continue
number
=
line
[
0
:
5
]
pos0x
=
line
.
find
(
" 0x"
)
posin
=
line
.
find
(
" in "
)
posat
=
line
.
find
(
" at "
)
poscol
=
line
.
find
(
":"
,
posat
)
if
pos0x
<
posin
and
pos0x
!=
-
1
:
bp
.
address
.
append
(
line
[
pos0x
+
1
:
posin
])
if
line
.
find
(
"<PENDING>"
)
>=
0
:
bp
.
address
.
append
(
"<PENDING>"
)
if
posin
<
posat
and
posin
!=
-
1
:
bp
.
function
=
line
[
posin
+
4
:
posat
]
if
posat
<
poscol
and
poscol
!=
-
1
:
bp
.
filename
=
line
[
posat
+
4
:
poscol
]
if
poscol
!=
-
1
:
bp
.
linenumber
=
line
[
poscol
+
1
:
-
1
]
if
'.'
in
number
:
# Part of multiple breakpoint.
continue
# A breakpoint of its own
bp
.
number
=
int
(
number
)
d
.
putCommaIfNeeded
()
d
.
put
(
'bkpt={number="%s"'
%
bp
.
number
)
d
.
put
(
',type="breakpoint"'
)
d
.
put
(
',disp="keep"'
)
d
.
put
(
',enabled="y"'
)
for
address
in
bp
.
address
:
d
.
put
(
',addr="%s"'
%
address
)
if
not
bp
.
function
is
None
:
d
.
put
(
',func="%s"'
%
bp
.
function
)
if
not
bp
.
filename
is
None
:
d
.
put
(
',file="%s"'
%
bp
.
filename
)
if
not
bp
.
fullname
is
None
:
d
.
put
(
',fullname="%s"'
%
bp
.
fullname
)
if
not
bp
.
linenumber
is
None
:
d
.
put
(
',line="%s"'
%
bp
.
linenumber
)
if
not
bp
.
condition
is
None
:
d
.
put
(
',cond="%s"'
%
bp
.
condition
)
if
not
bp
.
fullname
is
None
:
d
.
put
(
',fullname="%s"'
%
bt
.
fullname
)
if
not
bp
.
times
is
None
:
d
.
put
(
',times="1"'
%
bp
.
times
)
#d.put('original-location="-"')
d
.
put
(
'}'
)
bp
=
Breakpoint
()
def
listOfLocals
(
varList
):
try
:
frame
=
gdb
.
selected_frame
()
...
...
@@ -503,7 +607,15 @@ class FrameCommand(gdb.Command):
if
len
(
locals
)
and
len
(
watchers
):
sep
=
","
print
(
'data=['
+
locals
+
sep
+
watchers
+
']
\n
'
)
#
# Breakpoints
#
#d.safeoutput = ""
#listOfBreakpoints(d)
#d.pushOutput()
#breakpoints = d.safeoutput
print
(
'data=['
+
locals
+
sep
+
watchers
+
'],bkpts=['
+
breakpoints
+
']
\n
'
)
def
handleWatch
(
self
,
d
,
exp
,
iname
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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