Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Keystone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Third Party Mirrors
Keystone
Commits
29f61ff5
Commit
29f61ff5
authored
6 years ago
by
@tkmru
Committed by
Nguyen Anh Quynh
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix sample in go binding (#372)
parent
f231d0d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/go/README.md
+21
-21
21 additions, 21 deletions
bindings/go/README.md
with
21 additions
and
21 deletions
bindings/go/README.md
+
21
−
21
View file @
29f61ff5
# keystone
# keystone
Go bindings for the
[
keystone
](
http://www.keystone-engine.org/
)
engine.
## Sample
...
...
@@ -6,30 +6,30 @@ Go bindings for the [keystone](http://www.keystone-engine.org/) engine.
package
main
import
(
"fmt"
"os"
"fmt"
"os"
keystone
"github.com/keystone-engine/
beta
/bindings/go/keystone"
"github.com/keystone-engine/
keystone
/bindings/go/keystone"
)
func
main
()
{
assembly
:=
os
.
Args
[
1
]
if
ks
,
err
:=
keystone
.
New
(
keystone
.
A
rchitecture
X86
,
keystone
.
M
ode32
);
err
!=
nil
{
panic
(
err
)
}
else
{
defer
ks
.
Close
()
if
err
:=
ks
.
Option
(
keystone
.
OptionSyntax
,
keystone
.
OptionSyntaxIntel
);
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Could not set syntax option to intel"
))
}
if
insn
,
_
,
ok
:=
ks
.
Assemble
(
assembly
,
0
);
!
ok
{
panic
(
fmt
.
Errorf
(
"Could not assemble instruction"
))
}
else
{
fmt
.
Printf
(
"%s: [%x]"
,
assembly
,
insn
)
}
}
assembly
:=
os
.
Args
[
1
]
ks
,
err
:=
keystone
.
New
(
keystone
.
A
RCH_
X86
,
keystone
.
M
ODE_32
)
if
err
!=
nil
{
panic
(
err
)
}
defer
ks
.
Close
()
if
err
:=
ks
.
Option
(
keystone
.
OPT_SYNTAX
,
keystone
.
OPT_SYNTAX_INTEL
);
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Could not set syntax option to intel"
))
}
if
insn
,
_
,
ok
:=
ks
.
Assemble
(
assembly
,
0
);
!
ok
{
panic
(
fmt
.
Errorf
(
"Could not assemble instruction"
))
}
else
{
fmt
.
Printf
(
"%s: [%x]"
,
assembly
,
insn
)
}
}
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment