frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: Help with doing statistics over machine code

2•phafu•1y ago
I'd like to do some statistics over the machine code gcc generates, such as a histogram of used instructions, average volatile/preserved registers usage of functions etc. For now just x86_64 SysV-ABI would be enough.

However I'm not aware of any pre-existing tool that lets me easily do this. The options I currently see are either make gcc output assembly and write a parser for the GNU Assembler format (possibly by reusing the asm-parser of the compiler-explorer project), or write a tool that reads (disassembles) object files directly using elfutils.

Any hints, prior work, further ideas, links to useful resources, or any other kind of help would be much appreciated.

Comments

baobun•1y ago
"Static analysis" should be a relevant search term. Assuming you don't need to tie the instructions back to C code then the "gcc" part seems circumstancial for implementation? I guess you might want to parse the ASM into an Abstract Syntax Tree (AST) represenation and work on that?

If you do want to tie it back to the source, this looks relevant: http://icps.u-strasbg.fr/~pop/gcc-ast.html

phafu•1y ago
For my purpose I don't need to get back to the original source, no.

The gcc part is only relevant with regards to what dialect of assembler I need to parse. If I go that route, I'd write a parser for the GNU assembler, and that would of course work with any code in that dialect, regardless from which compiler it came from (I haven't checked whether other compilers can produce GNU assembler though).

Sorry if this is a dumb question, but

https://www.thetrueengineer.com/p/for-those-who-work-full-time-in-a
1•adletbalzhanov•17s ago•0 comments

Zuckerberg faces questions over why superyacht declined to help stranded boat

https://www.theguardian.com/us-news/2026/aug/09/zuckerberg-superyacht-boat-alaska
1•higginsniggins•27s ago•0 comments

The Fermi Paradox Just Got Worse [video]

https://www.youtube.com/watch?v=s-MgHZ_oGl0
1•Bender•1m ago•0 comments

John Crowley Has Died

https://en.wikipedia.org/wiki/John_Crowley_(author)
1•atombender•1m ago•0 comments

Idol Mahjong Final Romance: A Slideshow Disguised as a Video Game

https://nicole.express/2026/more-like-idle-mahjong.html
1•nicole_express•1m ago•0 comments

Polyethylene may be causing liver damage

https://scitechdaily.com/this-widely-used-plastic-could-be-harming-your-liver/
2•Gaishan•4m ago•0 comments

Show HN: Lumabri – What if LLMs worked like Napster?

https://github.com/JustVugg/lumabri
1•vforno•4m ago•0 comments

3G at Last

https://nickvsnetworking.com/3g-at-last/
1•birdculture•11m ago•0 comments

The malignant rise of OnlyFans managers

https://www.theguardian.com/society/2026/jun/18/malignant-rise-onlyfans-managers-exploiting-groom...
3•mukmuk•12m ago•1 comments

An AI chief of staff for founders who can't afford one

https://useairo.co
1•vidit99•15m ago•0 comments

The rise of illegal tobacco in Australia tracked in wastewater

https://www.abc.net.au/news/2026-08-10/charting-the-rise-of-illegal-tobacco-in-australia/106941130
2•Gaishan•17m ago•0 comments

Neural Scaling Law

https://en.wikipedia.org/wiki/Neural_scaling_law
1•frozenseven•18m ago•0 comments

Testing Anthropic's RSI Claims

https://ankitmaloo.com/rsi-claims/
1•ankit219•21m ago•0 comments

Quoted $1M for AI code review. Built it for free

https://sagivo.com/blog/i-was-quoted-1m-to-get-ai-diff-review-tool
3•shubidubi•21m ago•0 comments

What Garbage Collection Costs

https://shivanshuag.com/blog/what-garbage-collection-actually-costs/
1•shivanshuag•22m ago•0 comments

Who Should Pay for Source Code Availability?

https://kristoff.it/blog/source-code-availability/
1•Retro_Dev•22m ago•0 comments

Black lung rates in Appalachia are high as the 1970s

https://text.npr.org/nx-s1-5894884
4•mooreds•26m ago•0 comments

I got 30% better AI coding results

https://github.com/akasula09/CodeSlimmer
1•kushthedevmmm•26m ago•0 comments

To Recruit Teachers, School Districts Are Building Homes

https://www.nytimes.com/2026/07/28/business/affordable-housing-schools-teachers.html
5•mooreds•28m ago•0 comments

Sen. Chuck Grassley mourns Beth, 49yo vacuum cleaner

https://twitter.com/ChuckGrassley/status/2086178745191133662
2•nianderwallace•28m ago•0 comments

High car prices lead to long-term auto loans

https://www.marketplace.org/story/2026/08/07/high-car-prices-lead-to-longterm-auto-loans
3•mooreds•28m ago•1 comments

Tape scratching the "Peter Piper" routine, using a homemade tape loop [video]

https://www.youtube.com/watch?v=L6SMyND8hso
1•CharlesW•29m ago•0 comments

Why.com – Explore any topic by repeatedly asking why

https://why.com/
2•m5r•29m ago•0 comments

Quantifying dynamics of failure across science, startups and security

https://arxiv.org/abs/1903.07562
1•highfrequency•32m ago•0 comments

The Post-Quantum WebPKI

https://rmhrisk.github.io/classical-webpki/
1•tomwas54•35m ago•0 comments

AI assistant hacks gym website in first known Australian autonomous cyber attack

https://www.abc.net.au/news/2026-08-10/ai-assistant-hacks-gym-website-aus-cyber-attack/107007986
2•stared•36m ago•0 comments

Is Cyber Warfare the Next World War?

https://medium.com/freedomofthought/is-cyber-warfare-the-next-world-war-0305756d37eb
2•raynchad•36m ago•1 comments

Sam Zeloof Home Chip Fab: Silicon IC Fabrication in the Garage – Hackaday [video]

https://www.youtube.com/watch?v=23fTB3hG5cA
3•binyu•37m ago•0 comments

Cambridge University's Disgrace

https://fakenous.substack.com/p/cambridge-universitys-disgrace
4•barry-cotter•38m ago•1 comments

JavaScript for Unity

https://onejs.com
1•CreepGin•39m ago•0 comments