Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
exchain
nebula
Commits
bc294802
Unverified
Commit
bc294802
authored
May 03, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: clean up debug info during run
parent
3adfef32
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
matcher.go
cmd/matcher.go
+8
-0
run.go
cmd/run.go
+14
-11
No files found.
cmd/matcher.go
View file @
bc294802
...
@@ -15,6 +15,14 @@ type StepMatcherFlag struct {
...
@@ -15,6 +15,14 @@ type StepMatcherFlag struct {
matcher
StepMatcher
matcher
StepMatcher
}
}
func
MustStepMatcherFlag
(
pattern
string
)
*
StepMatcherFlag
{
out
:=
new
(
StepMatcherFlag
)
if
err
:=
out
.
Set
(
pattern
);
err
!=
nil
{
panic
(
err
)
}
return
out
}
func
(
m
*
StepMatcherFlag
)
Set
(
value
string
)
error
{
func
(
m
*
StepMatcherFlag
)
Set
(
value
string
)
error
{
m
.
repr
=
value
m
.
repr
=
value
if
value
==
""
||
value
==
"never"
{
if
value
==
""
||
value
==
"never"
{
...
...
cmd/run.go
View file @
bc294802
...
@@ -68,6 +68,12 @@ var (
...
@@ -68,6 +68,12 @@ var (
Value
:
"meta.json"
,
Value
:
"meta.json"
,
Required
:
false
,
Required
:
false
,
}
}
RunInfoAtFlag
=
&
cli
.
GenericFlag
{
Name
:
"info-at"
,
Usage
:
"step pattern to print info at: "
+
patternHelp
,
Value
:
MustStepMatcherFlag
(
"%1000"
),
Required
:
false
,
}
)
)
type
Proof
struct
{
type
Proof
struct
{
...
@@ -212,6 +218,7 @@ func Run(ctx *cli.Context) error {
...
@@ -212,6 +218,7 @@ func Run(ctx *cli.Context) error {
stopAt
:=
ctx
.
Generic
(
RunStopAtFlag
.
Name
)
.
(
*
StepMatcherFlag
)
.
Matcher
()
stopAt
:=
ctx
.
Generic
(
RunStopAtFlag
.
Name
)
.
(
*
StepMatcherFlag
)
.
Matcher
()
proofAt
:=
ctx
.
Generic
(
RunProofAtFlag
.
Name
)
.
(
*
StepMatcherFlag
)
.
Matcher
()
proofAt
:=
ctx
.
Generic
(
RunProofAtFlag
.
Name
)
.
(
*
StepMatcherFlag
)
.
Matcher
()
snapshotAt
:=
ctx
.
Generic
(
RunSnapshotAtFlag
.
Name
)
.
(
*
StepMatcherFlag
)
.
Matcher
()
snapshotAt
:=
ctx
.
Generic
(
RunSnapshotAtFlag
.
Name
)
.
(
*
StepMatcherFlag
)
.
Matcher
()
infoAt
:=
ctx
.
Generic
(
RunInfoAtFlag
.
Name
)
.
(
*
StepMatcherFlag
)
.
Matcher
()
var
meta
*
mipsevm
.
Metadata
var
meta
*
mipsevm
.
Metadata
if
metaPath
:=
ctx
.
Path
(
RunMetaFlag
.
Name
);
metaPath
==
""
{
if
metaPath
:=
ctx
.
Path
(
RunMetaFlag
.
Name
);
metaPath
==
""
{
...
@@ -241,23 +248,18 @@ func Run(ctx *cli.Context) error {
...
@@ -241,23 +248,18 @@ func Run(ctx *cli.Context) error {
for
!
state
.
Exited
{
for
!
state
.
Exited
{
step
:=
state
.
Step
step
:=
state
.
Step
//if infoAt(state) {
name
:=
meta
.
LookupSymbol
(
state
.
PC
)
// s := lookupSymbol(state.PC)
if
infoAt
(
state
)
{
// var sy elf.Symbol
// l.Info("", "insn", state.Memory.GetMemory(state.PC), "pc", state.PC, "symbol", sy.Name)
// // print name
//}
if
meta
.
LookupSymbol
(
state
.
PC
)
==
"runtime.notesleep"
{
return
fmt
.
Errorf
(
"got stuck in Go sleep at step %d"
,
step
)
}
if
step
%
100
==
0
||
step
>
14
_478_400
{
l
.
Info
(
"processing"
,
l
.
Info
(
"processing"
,
"step"
,
step
,
"step"
,
step
,
"pc"
,
mipsevm
.
HexU32
(
state
.
PC
),
"pc"
,
mipsevm
.
HexU32
(
state
.
PC
),
"insn"
,
mipsevm
.
HexU32
(
state
.
Memory
.
GetMemory
(
state
.
PC
)),
"insn"
,
mipsevm
.
HexU32
(
state
.
Memory
.
GetMemory
(
state
.
PC
)),
"name"
,
meta
.
LookupSymbol
(
state
.
PC
)
,
"name"
,
name
,
)
)
}
}
if
name
==
"runtime.notesleep"
{
// don't loop forever when we get stuck because of an unexpected bad program
return
fmt
.
Errorf
(
"got stuck in Go sleep at step %d"
,
step
)
}
if
stopAt
(
state
)
{
if
stopAt
(
state
)
{
break
break
...
@@ -319,5 +321,6 @@ var RunCommand = &cli.Command{
...
@@ -319,5 +321,6 @@ var RunCommand = &cli.Command{
RunSnapshotFmtFlag
,
RunSnapshotFmtFlag
,
RunStopAtFlag
,
RunStopAtFlag
,
RunMetaFlag
,
RunMetaFlag
,
RunInfoAtFlag
,
},
},
}
}
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