Settings

Theme

Lensm, a tool for viewing disassembly

storj.io

156 points by jtolds 2 years ago · 18 comments

Reader

vardump 2 years ago

Wow, having to stare at disassembly too often, I really like this.

Makes it much faster to follow branches and can easily see what instructions correspond to source code lines, even though it's not very exact at higher optimization levels.

This should be integrated in all IDEs.

  • mananaysiempre 2 years ago

    With recent versions of GNU objdump, you can use --source --visualize-jumps=color and perhaps also --reloc or --dynamic-reloc for a similar experience with the native toolchain. (Unfortunately, -S/--source absolutely sucks for executables compiled at -O2.)

    Other tricks include --no-addresses --no-show-raw-insn, which make the disassembly decently diffable.

  • PhilipRoman 2 years ago

    If you don't care about source lines, I find radare2 has a really good disassembler (in graph mode)

    It's meant for reverse engineering but I use it for debugging purposes too

c7DJTLrn 2 years ago

It would probably be worth mentioning that this is for Go in the title.

  • jcul 2 years ago

    I'd imagine it would work for any binary with debug symbols, even though the tool is written in go?

    Though I haven't tried it, on mobile right now.

    • liamwire 2 years ago

      I’m not so sure. From the article, the author mentions that they’re using an internal library from the Go compiler for the disassembly.

    • egonelbre 2 years ago

      Yeah, at the moment, unfortunately only works for Go.

      But implementing a different backend (e.g. llvm-symbolizer, objdump etc.) shouldn't be too difficult. The main things it needs to do are 1. list the decompilable symbols in the file, 2. disassemble and pull in the relevant source code.

      The UI part doesn't care whether it's Go or not.

    • vzaliva 2 years ago

      I tried it with C and it does not work. So I guess it is go-specific indeed.

      • MobiusHorizons 2 years ago

        Did you have debug symbols? I assume you probably passed -g, but the debug info can still not be compatible sometimes. I know when using lldb I sometimes have to force dwarf debug info or -ggdb to get it working.

      • jcul 2 years ago

        Yeah I just tried it too. It did disassemble it and showed jumps, but no source code. It also didn't resolve calls to functions like printf.

    • Conscat 2 years ago

      Can it demangle non-Go identifiers?

brancz 2 years ago

Love lensm! I've used it on several occasions to teach people about inlining, bounds check removals, and other performance related topics that are best highlighted by actually seeing differences in assembly. I find it's easier for people to understand what is actually happening under the hood than just tell them "do this and it's faster".

I also highly recommend following the creator. I'm always impressed with anything Egon creates.

throwaway29303 2 years ago

Previous threads about lensm

https://news.ycombinator.com/item?id=32138111 - Lensm, a Tool for Viewing Disassembly (2022)

https://news.ycombinator.com/item?id=32133394 - Lensm: Go Assembly and Source Viewer (2022)

djmips 2 years ago

I like the name, it reminds me of Lensman - the classic sci-fi series that inspired the first video game Spacewar!

speps 2 years ago

Looks a lot like the P4Merge diffing window: https://www.perforce.com/manuals/p4merge/Content/P4Merge/dif...

fitz-re 2 years ago

This would be great for reversing tools such as IDA and Binary Ninja!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection