mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Trying to grab backtrace. Didn't quite work
This commit is contained in:
parent
9c50f71391
commit
1efbdf84f4
4 changed files with 121 additions and 3 deletions
88
ewext/Cargo.lock
generated
88
ewext/Cargo.lock
generated
|
@ -2,6 +2,45 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
|
@ -12,9 +51,22 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
name = "ewext"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.158"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.8.5"
|
||||
|
@ -25,6 +77,42 @@ dependencies = [
|
|||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
|
|
|
@ -12,3 +12,4 @@ crate-type = ["cdylib"]
|
|||
|
||||
[dependencies]
|
||||
libloading = "0.8.5"
|
||||
backtrace = "0.3"
|
||||
|
|
|
@ -12,7 +12,36 @@ static LUA: LazyLock<Lua51> = LazyLock::new(|| unsafe {
|
|||
// const EWEXT: [(&'static str, Function); 1] = [("testfn", None)];
|
||||
|
||||
extern "C" fn test_fn(_lua: *mut lua_State) -> c_int {
|
||||
println!("test fn called");
|
||||
println!("\nStarting trace");
|
||||
backtrace::trace(|frame| {
|
||||
// let ip = frame.ip();
|
||||
let symbol_address = frame.symbol_address();
|
||||
|
||||
print!("symbol: {:#08X}", symbol_address as usize);
|
||||
if let Some(base) = frame.module_base_address() {
|
||||
print!(" base: {:#08X}", base as usize);
|
||||
}
|
||||
// Resolve this instruction pointer to a symbol name
|
||||
backtrace::resolve_frame(frame, |symbol| {
|
||||
if let Some(name) = symbol.name() {
|
||||
print!(" name: {name}");
|
||||
}
|
||||
if let Some(filename) = symbol.filename() {
|
||||
print!(" file: {}", filename.display());
|
||||
}
|
||||
});
|
||||
println!();
|
||||
|
||||
for i in 0..16 {
|
||||
let b: u8 =
|
||||
unsafe { std::ptr::read_volatile((symbol_address as *const u8).wrapping_add(i)) };
|
||||
print!("{:02X} ", b);
|
||||
}
|
||||
println!();
|
||||
|
||||
true // keep going to the next frame
|
||||
});
|
||||
println!("End trace\n");
|
||||
0
|
||||
}
|
||||
|
||||
|
@ -21,7 +50,7 @@ pub extern "C" fn luaopen_ewext(lua: *mut lua_State) -> c_int {
|
|||
println!("Initializing ewext");
|
||||
unsafe {
|
||||
LUA.lua_pushcclosure(lua, Some(test_fn), 0);
|
||||
LUA.lua_setfield(lua, LUA_GLOBALSINDEX, c"ewext".as_ptr())
|
||||
// LUA.lua_setfield(lua, LUA_GLOBALSINDEX, c"ewext".as_ptr())
|
||||
}
|
||||
// let mut luastate = unsafe { State::from_ptr(luastateptr) };
|
||||
// luastate.new_lib(&EWEXT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue