Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
H
hostCompiledSimulation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
hostCompiledSimulation
Commits
61e35be1
Commit
61e35be1
authored
Oct 07, 2014
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change to gdb_info.py to avoid GDB errors from stopping the tool.
Signed-off-by:
Gaurav Kukreja
<
gaurav@gauravk.in
>
parent
ac90b256
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
13 deletions
+28
-13
cGrammar.py
instrument/cGrammar.py
+4
-1
gdb_info.py
instrument/gdb_info.py
+24
-12
No files found.
instrument/cGrammar.py
View file @
61e35be1
...
@@ -25,6 +25,8 @@ BITXOR_OP = Literal("^")
...
@@ -25,6 +25,8 @@ BITXOR_OP = Literal("^")
BITOR_OP
=
Literal
(
"|"
)
BITOR_OP
=
Literal
(
"|"
)
BITAND_OP
=
Literal
(
"&"
)
BITAND_OP
=
Literal
(
"&"
)
CONSTANT_EXP
=
CONSTANT
+
Literal
(
"e"
)
+
(
ADD_OP
|
SUB_OP
)
+
CONSTANT
EQ_OP
=
Literal
(
"=="
)
EQ_OP
=
Literal
(
"=="
)
NE_OP
=
Literal
(
"!="
)
NE_OP
=
Literal
(
"!="
)
GT_OP
=
Literal
(
">"
)
GT_OP
=
Literal
(
">"
)
...
@@ -223,6 +225,7 @@ def act_lparen_expression(tokens):
...
@@ -223,6 +225,7 @@ def act_lparen_expression(tokens):
expression
=
Forward
()
expression
=
Forward
()
primary_expression
=
(
IDENTIFIER
.
setParseAction
(
act_identifier
)
primary_expression
=
(
IDENTIFIER
.
setParseAction
(
act_identifier
)
^
CONSTANT
^
CONSTANT
^
CONSTANT_EXP
^
STRING_LITERAL
^
STRING_LITERAL
^
((
LPAREN
.
setParseAction
(
act_lparen_expression
)
+
expression
+
RPAREN
.
setParseAction
(
act_rparen_expression
)))
^
((
LPAREN
.
setParseAction
(
act_lparen_expression
)
+
expression
+
RPAREN
.
setParseAction
(
act_rparen_expression
)))
)
)
...
@@ -271,7 +274,7 @@ def act_array_index_lbrace(tokens):
...
@@ -271,7 +274,7 @@ def act_array_index_lbrace(tokens):
# Removing Left Recursion
# Removing Left Recursion
postfix_expression_1
=
Forward
()
postfix_expression_1
=
Forward
()
postfix_expression_1
<<
(
(
Literal
(
"["
)
.
setParseAction
(
act_array_index_lbrace
)
+
Combine
(
expression
)
.
setParseAction
(
act_array_index_expression
)
+
Literal
(
"]"
)
.
setParseAction
(
act_array_index_rbrace
))
postfix_expression_1
<<
(
(
Literal
(
"["
)
.
setParseAction
(
act_array_index_lbrace
)
+
Combine
(
expression
)
.
setParseAction
(
act_array_index_expression
)
+
Literal
(
"]"
)
.
setParseAction
(
act_array_index_rbrace
)
+
postfix_expression_1
)
|
(
PTR_OP
+
IDENTIFIER
+
postfix_expression_1
)
|
(
PTR_OP
+
IDENTIFIER
+
postfix_expression_1
)
|
(
Literal
(
"."
)
+
IDENTIFIER
+
postfix_expression_1
)
|
(
Literal
(
"."
)
+
IDENTIFIER
+
postfix_expression_1
)
|
Empty
()
|
Empty
()
...
...
instrument/gdb_info.py
View file @
61e35be1
...
@@ -53,6 +53,15 @@ def debugListVariables(listVariables):
...
@@ -53,6 +53,15 @@ def debugListVariables(listVariables):
print
""
print
""
def
gdbxFilePrefix
(
file
):
file
.
write
(
"python
\n
"
)
file
.
write
(
"def exe(arg):
\n
"
)
file
.
write
(
"
\t
try:
\n
"
)
file
.
write
(
"
\t\t
gdb.execute (arg)
\n
"
)
file
.
write
(
"
\t
except:
\n
"
)
file
.
write
(
"
\t\t
pass
\n
"
)
file
.
write
(
"
\t
pass
\n
"
)
# class GlobalVariable:
# class GlobalVariable:
# def __init__(self):
# def __init__(self):
# self.name = ""
# self.name = ""
...
@@ -229,6 +238,7 @@ def getLocalVariablesForAllFunc(listBinaryFileNames, listFunctionsObj):
...
@@ -229,6 +238,7 @@ def getLocalVariablesForAllFunc(listBinaryFileNames, listFunctionsObj):
gdbOFileName
=
"/tmp/"
+
func
.
functionName
+
".lVarName.gdbo"
gdbOFileName
=
"/tmp/"
+
func
.
functionName
+
".lVarName.gdbo"
gdbXFile
=
open
(
gdbXFileName
,
'w'
)
gdbXFile
=
open
(
gdbXFileName
,
'w'
)
# gdbxFilePrefix(gdbXFile)
gdbXFile
.
write
(
"target sim
\n
"
)
gdbXFile
.
write
(
"target sim
\n
"
)
gdbXFile
.
write
(
"load
\n
"
)
gdbXFile
.
write
(
"load
\n
"
)
gdbXFile
.
write
(
"b
%
s
\n
"
%
func
.
functionName
)
gdbXFile
.
write
(
"b
%
s
\n
"
%
func
.
functionName
)
...
@@ -276,6 +286,7 @@ def getLocalVariablesForAllFunc(listBinaryFileNames, listFunctionsObj):
...
@@ -276,6 +286,7 @@ def getLocalVariablesForAllFunc(listBinaryFileNames, listFunctionsObj):
gdbOFile
.
close
()
gdbOFile
.
close
()
gdbXFile
=
open
(
gdbXFileName
,
'w'
)
gdbXFile
=
open
(
gdbXFileName
,
'w'
)
# gdbxFilePrefix(gdbXFile)
gdbXFile
.
write
(
"target sim
\n
"
)
gdbXFile
.
write
(
"target sim
\n
"
)
gdbXFile
.
write
(
"load
\n
"
)
gdbXFile
.
write
(
"load
\n
"
)
gdbXFile
.
write
(
"info scope
%
s
\n
"
%
func
.
functionName
)
gdbXFile
.
write
(
"info scope
%
s
\n
"
%
func
.
functionName
)
...
@@ -303,20 +314,21 @@ def getLocalVariablesForAllFunc(listBinaryFileNames, listFunctionsObj):
...
@@ -303,20 +314,21 @@ def getLocalVariablesForAllFunc(listBinaryFileNames, listFunctionsObj):
gdbOFile
.
close
()
gdbOFile
.
close
()
gdbXFile
=
open
(
gdbXFileName
,
'w'
)
gdbXFile
=
open
(
gdbXFileName
,
'w'
)
gdbXFile
.
write
(
"target sim
\n
"
)
gdbxFilePrefix
(
gdbXFile
)
gdbXFile
.
write
(
"load
\n
"
)
gdbXFile
.
write
(
'exe("target sim")
\n
'
)
gdbXFile
.
write
(
"b
%
s
\n
"
%
func
.
functionName
)
gdbXFile
.
write
(
'exe("load")
\n
'
)
gdbXFile
.
write
(
"commands
\n
"
)
gdbXFile
.
write
(
'exe("b
%
s")
\n
'
%
func
.
functionName
)
gdbXFile
.
write
(
"
\t
printf
\"
SP =
%
s
\\
n
\"
,
%
s
\n
"
%
(
"
%
x"
,
"$sp"
))
# gdbXFile.write('exe("commands")\n')
gdbXFile
.
write
(
'exe("
\t
printf
\\
"SP =
%
s
\\\\
n
\\
",
%
s")
\n
'
%
(
"
%
x"
,
"$sp"
))
for
varName
in
listLocalVarNames
:
for
varName
in
listLocalVarNames
:
gdbXFile
.
write
(
"
\t
printf
\"
LocalVar:
%
s
\\
n
\"\n
"
%
(
varName
))
gdbXFile
.
write
(
'exe(
\'
printf "LocalVar:
%
s
\\\\
n"
\'
)
\n
'
%
(
varName
))
gdbXFile
.
write
(
"
\t
printf
\"
address = 0x
%
s
\\
n
\"
, &
%
s
\n
"
%
(
"
%
x"
,
varName
))
gdbXFile
.
write
(
'exe(
\'
printf "address = 0x
%
s
\\\\
n", &
%
s
\'
)
\n
'
%
(
"
%
x"
,
varName
))
gdbXFile
.
write
(
"
\t
ptype
%
s
\n
"
%
varName
)
gdbXFile
.
write
(
'exe(
\'
ptype
%
s
\'
)
\n
'
%
varName
)
gdbXFile
.
write
(
"
\t
printf
\"
size =
%
s
\\
n
\"
, sizeof(
%
s)
\n
"
%
(
"
%
d"
,
varName
))
gdbXFile
.
write
(
'exe(
\'
printf "size =
%
s
\\\\
n", sizeof(
%
s)
\'
)
\n
'
%
(
"
%
d"
,
varName
))
# gdbXFile.write("\tcont\n")
# gdbXFile.write("\tcont\n")
gdbXFile
.
write
(
"end
\n
"
)
# gdbXFile.write('exe("end")\n'
)
gdbXFile
.
write
(
"run
\n
"
)
gdbXFile
.
write
(
'exe("run")
\n
'
)
gdbXFile
.
write
(
"quit
\n
"
)
gdbXFile
.
write
(
'exe("quit")
\n
'
)
gdbXFile
.
close
()
gdbXFile
.
close
()
gdbOFile
=
open
(
gdbOFileName
,
'w'
)
gdbOFile
=
open
(
gdbOFileName
,
'w'
)
...
...
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