Conversation
Contributor
|
Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/src/disasm.jl b/src/disasm.jl
index fc8f3e98..8cf26bfa 100644
--- a/src/disasm.jl
+++ b/src/disasm.jl
@@ -13,7 +13,7 @@ function dispose(ctx::DisasmContext)
return nothing
end
-function disassemble_code(io, ctx::DisasmContext, native_code::Vector{UInt8}, code_addr::Csize_t = 0; bufsize=32)
+function disassemble_code(io, ctx::DisasmContext, native_code::Vector{UInt8}, code_addr::Csize_t = 0; bufsize = 32)
pos = 1
buf = Vector{UInt8}(undef, bufsize)
@@ -37,4 +37,4 @@ function disassemble_code(io, ctx::DisasmContext, native_code::Vector{UInt8}, co
write(io, '\n')
end
return nothing
-end
\ No newline at end of file
+end
diff --git a/test/disasm.jl b/test/disasm.jl
index 679358cc..8e30d500 100644
--- a/test/disasm.jl
+++ b/test/disasm.jl
@@ -10,4 +10,4 @@ import LLVM: create_disasm, disassemble_code
LLVM.dispose(ctx)
@test disassembled == "\tpushq\t%rbp\n\tmovq\t%rsp, %rbp\n\tmovq\t16(%r13), %rax\n\tmovq\t16(%rax), %rax\n\tmovq\t(%rax), %rax\n\tmovq\t(%rsi), %rdx\n\taddq\t\$8, %rsi\n\tmovabsq\t\$140619409620192, %rax\n\tcallq\t*%rax\n\tpopq\t%rbp\n"
-end
\ No newline at end of file
+end
diff --git a/test/runtests.jl b/test/runtests.jl
index 81ead7d5..6c2e7dd6 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -41,7 +41,7 @@ include("debuginfo.jl")
include("util.jl")
include("interop.jl")
include("orc.jl")
-include("disasm.jl")
+ include("disasm.jl")
if !Sys.iswindows()
# XXX: hangs on Windows
include("jljit.jl") |
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## master #522 +/- ##
==========================================
+ Coverage 87.91% 87.98% +0.07%
==========================================
Files 45 46 +1
Lines 2705 2731 +26
==========================================
+ Hits 2378 2403 +25
- Misses 327 328 +1
🚀 New features to boost your workflow:
|
gbaraldi
reviewed
Aug 26, 2025
| @testset "X86 Disassembly" begin | ||
| # Example from jitdump | ||
| native_code = UInt8[0x55, 0x48, 0x89, 0xe5, 0x49, 0x8b, 0x45, 0x10, 0x48, 0x8b, 0x40, 0x10, 0x48, 0x8b, 0x00, 0x48, 0x8b, 0x16, 0x48, 0x83, 0xc6, 0x08, 0x48, 0xb8, 0xe0, 0x7c, 0xf5, 0x81, 0xe4, 0x7f, 0x00, 0x00, 0xff, 0xd0, 0x5d, 0xc3] | ||
| code_addr = 0x00007fe48befcde0 |
Contributor
There was a problem hiding this comment.
Maybe a comment explaining the PC
maleadt
reviewed
Sep 1, 2025
Comment on lines
+6
to
+9
| function create_disasm(triple) | ||
| ctx = DisasmContext(API.LLVMCreateDisasm(triple, C_NULL, 0, C_NULL, C_NULL)) | ||
| return ctx | ||
| end |
Member
There was a problem hiding this comment.
Maybe this is my OOP kicking in, but why not tie this to a DisasmContext constructor like we do for other objects-like things (Context, IRBuilder, etc)?
maleadt
reviewed
Sep 1, 2025
| return nothing | ||
| end | ||
|
|
||
| function disassemble_code(io, ctx::DisasmContext, native_code::Vector{UInt8}, code_addr::Csize_t = 0; bufsize=32) |
Member
There was a problem hiding this comment.
What about simply disassemble? A do-block version could be provided that does the context construction for you.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc: @gbaraldi