Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Failed to instrument ] #815

Open
nalreddy opened this issue Aug 13, 2024 · 0 comments
Open

[Failed to instrument ] #815

nalreddy opened this issue Aug 13, 2024 · 0 comments

Comments

@nalreddy
Copy link

I am trying to instrument following application https://github.com/ls1mardyn/ls1-mardyn.

Tried to instrument all the functions above binary. For couple of functions getting GUM_INSTRUMENTATION_ERROR_WRONG_SIGNATURE

Could you please let me know what's issue and when does it happen, let me know if you need more info to debug.
Does Frida has any restrictions on what kind of functions that can be instrumented ?

Details

Frida : latest git clone

Linux : satya@llvm-ssp312:~/.../src$ cat /etc/os-release
PRETTY_NAME="Ubuntu 23.04"
NAME="Ubuntu"
VERSION_ID="23.04"
VERSION="23.04 (Lunar Lobster)"
VERSION_CODENAME=lunar

Tried this script
const moduleName = '/home/user/app/ls1-mardyn/build/src/MarDyn'; // Replace with your binary's name

// Wait for the module to be loaded
Process.waitForEvent('module-loaded', { name: moduleName });

// Find the module
const module = Process.getModuleByName(moduleName);
const baseAddress = module.base;

// Iterate through all functions in the module
module.enumerateExports().forEach(function (exp) {
// Attach a hook to each exported function
Interceptor.attach(exp.address, {
onEnter: function (args) {
console.log('Intercepted function:', exp.name || '');
console.log(' Arguments:');
for (let i = 0; i < Math.min(args.length, 4); i++) { // Print up to 4 arguments
console.log( arg${i}: ${args[i]});
}
},
onLeave: function (retval) {
console.log('Function returned:', retval.toInt32());
}
});
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant