Skip to content

Conversation

@withzombies
Copy link
Contributor

IDB::function_containing_address(ea)
IDB::set_name(ea, str)
IDB::set_function_name(ea, str)
IDB::types()
IDB::parse_types_from_header(path)
IDB::get_type_at_address(ea)

Function::name()
Function::set_noret(bool)
Function::set_name(strings)
Function::get_type()
Function::set_type()

Segment::set_permissions()

New Type class for convience functions on tinfo
Type::name()
Type::apply_to_address()

IDB::function_containing_address(ea)
IDB::set_name(ea, str)
IDB::set_function_name(ea, str)
IDB::types()
IDB::parse_types_from_header(path)
IDB::get_type_at_address(ea)

Function::name()
Function::set_noret(bool)
Function::set_name(strings)
Function::get_type()
Function::set_type()

Segment::set_permissions()

New Type class for convience functions on tinfo
Type::name()
Type::apply_to_address()
@xorpse xorpse self-requested a review August 9, 2025 00:52
@xorpse
Copy link
Contributor

xorpse commented Sep 6, 2025

Thank you for the PR and sorry for the delay in providing review. Before we merge this I'd like to figure out a reasonable way to model mutation on the IDB in a way that works nicely with Rust's ergonomics, e.g., having Function::set_name, would effectively mutate the IDB itself, but we are "borrowing" it immutably at the moment via Function... so the API could be confusing and misaligned with how things should be modelled in Rust (it's also one of the reasons why I've avoided adding any set_XXX methods on entities borrowed from the IDB until this point). The problem I see at the moment is this:

let mut idb = ...;
let mut f1 = idb.function_at(0x1000u64);
let f2 = idb.function_at(0x1000u64);

// f1 and f2 are the same

f1.set_name("..."); // f2 is also "mutated"

Ideally, I'd like something like this:

let mut idb = ...;
let mut f1 = idb.function_at_mut(0x1000u64);
let f2 = idb.function_at(0x1000u64); // not possible due to mutable ref via f1

f1.set_name("...");

I have a sketch of a solution, which should be ready "soon", after that we'll be in a position to merge the functionality you've added. Thanks again for your contribution!

@withzombies
Copy link
Contributor Author

That's a very good point. I haven't spent a lot of time wrapping C/C++ apis in Rust. That mutability issue is pretty major oversight by me.

I'll wait to do anything until your sketch is ready!

@xorpse xorpse added the v0.8.0 Feature part of v0.8.0 release label Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.8.0 Feature part of v0.8.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants