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

debug info for OCaml runtime #5583

Closed
vicuna opened this issue Apr 11, 2012 · 3 comments
Closed

debug info for OCaml runtime #5583

vicuna opened this issue Apr 11, 2012 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Apr 11, 2012

Original bug ID: 5583
Reporter: @ygrek
Assigned to: @damiendoligez
Status: resolved (set by @mshinwell on 2016-12-08T09:10:57Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.04.0
Category: runtime system and C interface

Bug description

Please compile the C code comprising OCaml runtime with debug information, so that looking into internal structures with gdb at run time is easier.

E.g. currently :

(gdb) p &caml_ref_table
$1 = (<data variable, no debug info> *) 0xbed2c0

Also when compiling C bindings ocamlc should do the same.

Currently -g is enabled for the debug runtime, but it has runtime cost due to -DDEBUG.

@vicuna
Copy link
Author

vicuna commented May 2, 2012

Comment author: @damiendoligez

What is the cost of doing this? Does -g preclude some optimizations? How much bigger is the executable? How many people want to look at the runtime with gdb? Don't they already know how to recompile with symbols?

@vicuna
Copy link
Author

vicuna commented May 7, 2012

Comment author: @ygrek

-g normally shouldn't change the generated code (but see http://stackoverflow.com/a/89619/118799), it only adds debugging sections, so the executable naturally becomes bigger. Those sections are not loaded at runtime, so the RAM usage is not affected. Debugger maps those sections to memory when needed. Moreover, debug info can be stripped from the binaries and distributed separately (that's a common practice in various distros, witness -dbg packages in debian).

Size change after ./configure -cc 'gcc -g' :

lib/ocaml/*.a : 3.7M -> 5.9M
libasmrun.a : 296K -> 824K
libcamlrun.a : 344K -> 968K

Probably those who need it can recompile manually. My reason was that it doesn't hurt and can be useful sometimes.

@vicuna
Copy link
Author

vicuna commented Dec 8, 2016

Comment author: @mshinwell

In 4.04 the runtime is compiled with -g.

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

No branches or pull requests

2 participants