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

Sort Symbols by Name or Address #22

Open
jgreenbaum opened this issue Sep 12, 2024 · 2 comments
Open

Sort Symbols by Name or Address #22

jgreenbaum opened this issue Sep 12, 2024 · 2 comments
Labels
effort: medium Something that can be done quickly with some effort enhancement New feature or request good first issue Good for newcomers

Comments

@jgreenbaum
Copy link

Is your feature request related to a problem? Please describe.

Often I'm looking for symbols around a particular address. I can search for a particular address, but not sort by address so I can browse symbols surrounding an address.

Describe the solution you'd like

A key to sort by address, or sort by name

Describe alternatives you've considered

top is an example of a text UI that provides flexible sorting, like shift-p to sort by process load, and shift-m to sort by memory usage.

Additional context

Filtering would be nice too, like "only show symbols of type FUNC", or sort by symbol type then name or address.

@jgreenbaum jgreenbaum added the enhancement New feature or request label Sep 12, 2024
@jgreenbaum
Copy link
Author

This should be easy. If you know how you would like this done I can look at prototyping.

@orhun
Copy link
Owner

orhun commented Sep 13, 2024

Hey, thanks for the issue & idea! I like it ⚡

I think we can add a new key binding (e.g. s) to change the sorting. You can take a look at src/elf/symbols.rs to get an idea of the data structure being used there.

It is wrapped in the Elf struct:

binsider/src/elf/mod.rs

Lines 81 to 100 in 236d19e

/// ELF wrapper.
#[derive(Debug)]
pub struct Elf {
/// File headers.
pub file_headers: FileHeaders,
/// Program headers.
pub program_headers: ProgramHeaders,
/// Section headers.
pub section_headers: SectionHeaders,
/// Symbols.
pub symbols: Symbols,
/// Dynamic symbols.
pub dynamic_symbols: DynamicSymbols,
/// Dynamic.
pub dynamic: Dynamic,
/// Relocations.
pub relocations: Relocations,
/// Notes.
pub notes: Notes,
}

And that can be accessed via state.analyzer:

binsider/src/app.rs

Lines 27 to 28 in 236d19e

/// Elf properties.
pub elf: Elf,

So we can modify that data to apply the sorting :)

Would you be down to implement it? 🐻

@orhun orhun removed their assignment Sep 24, 2024
@orhun orhun added good first issue Good for newcomers effort: medium Something that can be done quickly with some effort labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium Something that can be done quickly with some effort enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants