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).

The Oldest Problem That Was Never Solved

https://www.nirajgohil.com/essay/the-oldest-problem/
1•Niraj1513•6m ago•0 comments

What Is AI Native Development?

https://brunelly.com/articles/what-is-ai-native-development
1•rihabzt•9m ago•0 comments

No Cost EMI: Full Guide, Eligibility, Benefits and Details – SMFG India Credit

https://www.smfgindiacredit.com/knowledge-center/what-is-no-cost-emi.aspx
1•saumyaraut11•11m ago•0 comments

Underspecification Does Not Imply Incoherence in LLM Code Generation

https://arxiv.org/abs/2607.01953
1•ilreb•12m ago•0 comments

Who runs this propaganda machine?

https://clocktowerx.com/
1•smalltorch•13m ago•1 comments

How to Follow a Drummer

https://drummate.app/blog/how-to-follow-a-drummer
1•sashyo•15m ago•0 comments

FIFA lifts Balogun's World Cup suspension after Trump calls Infantino

https://www.france24.com/en/sport/20260705-fifa-lifts-balogun-world-cup-suspension-trump-call
1•Tomte•31m ago•0 comments

Learn Faster with Your Personal AI Teacher

https://aischoolbuilder.com/school/school-1786
1•bokeke1•34m ago•0 comments

The final voyage of USS Nimitz

https://news.usni.org/2026/07/03/uss-nimitz-an-aircraft-carriers-final-journey
4•Gaishan•41m ago•1 comments

4D-printing method creates lighter, faster-spinning wind turbine blades

https://www.concordia.ca/cunews/encs/2026/07/02/research-new-4d-printing-method-creates-lighter-f...
1•geox•47m ago•0 comments

How AI Poisons Creativity [video]

https://www.youtube.com/watch?v=WeCSzEtZcUw
3•g-andrade•50m ago•0 comments

Cewsco – a multimodal AI assistant powered by Dravik

https://cewsco.com/
1•kalkalka•55m ago•0 comments

Stop Patching the Dammed IoT Kernel – Native Immunity Is the Only Way Out

https://twitter.com/i/status/2073850360771612865
1•xxBoson•1h ago•0 comments

Fable 5 Used to Port Command and Conquer: Generals Zero Hour to iOS

https://twitter.com/ammaar/status/2073501877753323772
1•beatthatflight•1h ago•0 comments

Oatmeal Spice: Interesting Procedurally Generated Output

https://www.boristhebrave.com/2026/07/05/oatmeal-spice/
1•lispybanana•1h ago•0 comments

Hideo Kojima on PlayStation killing discs, 'frightened' for future of ownership

https://www.videogameschronicle.com/news/hideo-kojima-really-sad-about-playstation-killing-discs-...
2•thunderbong•1h ago•0 comments

Bad to worse at NSF? (June 2026 edition)

http://nanoscale.blogspot.com/2026/06/bad-to-worse-at-nsf-june-2026-edition.html
1•osnium123•1h ago•0 comments

Apple sells me a MacBook to deliver $1700; cancels 5 days later quoting $2000?

6•aerodog•1h ago•1 comments

US Car Payments Hit a Record $777 a Month as Down Payments Drop

https://www.bloomberg.com/news/articles/2026-07-01/us-car-payments-hit-a-record-777-a-month-as-do...
3•mattas•1h ago•1 comments

Mondegreen

https://en.wikipedia.org/wiki/Mondegreen
3•JKCalhoun•1h ago•0 comments

YouTube urges creators to fight proposed UK algorithm changes

https://www.dexerto.com/entertainment/youtube-urges-creators-to-fight-proposed-uk-algorithm-chang...
1•thesmtsolver2•1h ago•0 comments

What should a personal website be?

https://ratfactor.com/cards/personal-website
2•vinhnx•1h ago•1 comments

A Novel Look at Error Handling in Rust

https://jtjlehi.github.io/2026/06/25/novel-rust-error-handling.html
2•vinhnx•1h ago•0 comments

Whyline – company memory engine (SQLite, BM25, MCP for Cursor)

https://github.com/Sunradiance/whyline
1•sunradiance•1h ago•0 comments

ABI vs. API (2004)

https://lists.debian.org/debian-user/2004/02/msg00648.html
1•vinhnx•1h ago•0 comments

The White House Campaign to Overturn a World Cup Red Card

https://www.wsj.com/sports/soccer/white-house-fifa-balogun-red-card-world-cup-46276fc8
19•JumpCrisscross•1h ago•2 comments

Designing GPU-Accelerated Query Engines with NVIDIA GQE

https://developer.nvidia.com/blog/designing-gpu-accelerated-query-engines-with-nvidia-gqe/
1•c_lutz•1h ago•0 comments

TaskLoco Is the Sticky Note To-Do App for Visual Thinkers

https://www.taskloco.com/
1•taskloco_nyc•1h ago•0 comments

Nobel Laureate in Chemistry Omar M. Yaghi joins Tsinghua University full-time

https://www.tsinghua.edu.cn/en/info/1244/14984.htm?trk=feed_main-feed-card_feed-article-content
4•osnium123•1h ago•1 comments

Americans of all ages are spending less time socializing

https://www.axios.com/2026/07/05/americans-socializing-decline
2•toomuchtodo•1h ago•0 comments