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

improve gnu ELF for valgrind #4642

Closed
vicuna opened this issue Nov 7, 2008 · 1 comment
Closed

improve gnu ELF for valgrind #4642

vicuna opened this issue Nov 7, 2008 · 1 comment
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Nov 7, 2008

Original bug ID: 4642
Reporter: apoirot
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2008-11-08T16:11:54Z)
Resolution: fixed
Priority: normal
Severity: tweak
Version: 3.11.0+beta
Category: ~DO NOT USE (was: OCaml general)

Bug description

They is currently no way to use valgrind in callgrind mode for native ocaml programs.
Actually I checked valgrind sources and found that it ignores zero length symbols.
(checked with : valgrind --trace-symtab=yes ./test)
Symbol's length is computed with .size intructions which ocaml compiler doesn't add.

I'm a real beginner in ELF asm, but with some C reverse engineering I made a simple 2-lines patch which add theses intructions and open a new (great) way for debugging native programs!

Additional information

I wrote a clean note (in french) with ELF examples and some examples of valgrind and kcachegrind use :
http://blog.techno-barje.fr/post/2008/06/20/ocaml-callgraph

File attachments

@vicuna
Copy link
Author

vicuna commented Nov 8, 2008

Comment author: @xavierleroy

I wasn't aware of the callgrind mode of valgrind, but that's an interesting alternative to gprof profiling. I'll add the .size declarations to the x86/ELF and amd64/ELF code generators, in release 3.11.

Concerning anonymous functions, it might be possible to encode line number information in the functions' names at relatively low cost. I haven't checked the details but that's something to keep in mind.

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

No branches or pull requests

2 participants