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

Mach Fat binary needs a file picker/popup #281

Open
m4b opened this issue Apr 7, 2017 · 4 comments
Open

Mach Fat binary needs a file picker/popup #281

m4b opened this issue Apr 7, 2017 · 4 comments

Comments

@m4b
Copy link
Collaborator

m4b commented Apr 7, 2017

Currently, can't load a mach fat binary (because which one do we load?), so we need some kind of picker/selector, which presents the user a list of the architectures, which the user selects, which then loads that binary.

This seems mostly a QML issue (which I'm not good at, hoping someone will grab this issue).

So to sketch out a basic approach (which I haven't thought too consciously about), for starters, once a mach fat is selected (which should sent the mach-fat request kind), can iterate through arches with something like:

            Hint::MachFat(_) => {
                let multi = mach::MultiArch::new(&bytes)?;
                let arches = multi.arches()?;

And then display the arches as appropriate to the user (need a new UI selector or something here)

The user will then select the architecture (which can simply be an index), and the mach-o binary can then be extracted and loaded via:

// this is the ith arch
let bytes = arch.slice(bytes)?;
loader::load_mach(bytes, 0, NameOfBinary)

which gets routed appropriately somehow ;)

Or something like that; there are several possible avenues here

@flanfly
Copy link
Member

flanfly commented May 22, 2017

Why not load all of them? A Project can contain multiple Program instances.

@m4b
Copy link
Collaborator Author

m4b commented May 22, 2017

Hmmm yea that's probably the easiest. Perhaps we should make the disassembly step after loading lazy though as loading several architectures eagerly probably doesn't make a lot of sense. Perhaps disassembler fires when a program element first receives focus ?

@flanfly
Copy link
Member

flanfly commented May 22, 2017

Well, for there is no PPC disassembler anyway. Starting with x86 is the best we can do for now.

@m4b
Copy link
Collaborator Author

m4b commented May 23, 2017

Yea, I was specifically worried about the i386 and x86_64 fat binaries, which are usually the system libraries like libSystem_B.dylib, et. al. Seems a waste to load the i386 and x86_64 eagerly, especially for larger binaries.

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

No branches or pull requests

2 participants