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
[PATCH] Remove need for -I directives to ocamldebug in common case #6270
Comments
Comment author: @yallop The patch works as advertised for me, and seems like a significant usability improvement. |
Comment author: @alainfrisch (Disclaimer: comments below are only based on a quick read of the patch. I haven't tried it.) Always turning filename into absolute paths in debug event locations can drawbacks:
|
Comment author: jwatzmanfb
Ah, yeah, good point. Do you think it would be better to add a new field next to ev_loc, like ev_abs_path, that is used only for this purpose? I think this would work well for add_dirs_from_symbols but source_of_module would need some plumbing (which I'm willing to do, just checking first :)).
Didn't realize the details of this, thanks for letting me know. I'll make sure this is fixed when I fix the above issue. |
Comment author: @xclerc I basically agree with Alain, and am wondering: |
Comment author: @alainfrisch
We use -absname for all our code (to facilitate jumping to the location of errors), but would not like to increase the size of bytecode/.cds file nor to include full paths in backtrace. (Internally we use bytecode only for internal development -- so we would not really mind about backtraces containing full paths. But some of our clients might recompile and use bytecode in production on platforms which don't have a native backend.) |
Comment author: @alainfrisch
Do we really want to include absolute path information directly in debug events? What about using an extra (optional) section in the .cds or bytecode files? |
Comment author: jwatzmanfb
No, we probably don't need to, it was just the only way that I knew how to do it :)
That sounds like a better idea, I will look into this. Do you have a pointer to where the sections to the cds and bytecode files are defined/serialized, or documentation about it? If not, no worries, I'm sure I can dig in and figure it out eventually. |
Comment author: jwatzmanfb Given that you are now accepting pull requests on github, I just sent #14 as an update to this ticket. Sorry to take so log to respond -- this is a side project for me and I just found time to work on it again earlier today :) |
Comment author: jwatzmanfb Ping again :) I'm told that one of xclerc or frisch needs to sign off on the patch getting incorporated into SVN -- would one of you mind to take a look and either commit the patch or provide feedback that I can use to make another revision? The previous version has been sitting for about a month, and I just made another minor tweak to it which makes it even more non-intrusive. Would appreciate the review and am happy to keep revising it if it's still not acceptable, just let me know here or on GitHub. Thanks! |
Comment author: @xclerc The patch, as reviewed/commented/amended on github, |
Original bug ID: 6270
Reporter: jwatzmanfb
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2016-12-07T10:47:34Z)
Resolution: fixed
Priority: normal
Severity: minor
Category: tools (ocaml{lex,yacc,dep,debug,...})
Tags: patch
Related to: #6841
Monitored by: @gasche @yakobowski
Bug description
The need for a long list of -I directives makes interactively using ocamldebug a pain in the butt. Many folks have solved this with various
find
invocations or even Python wrappers, but those lead to other problems when it might include files you weren't expecting (or miss things you were). But all of this is really annoying since the tooling should be able to figure out itself, even heuristically, where your source files are -- gdb gets this right, why can't we?This patch implements one of the more important heuristics from gdb: you typically debug on the same machine you built on, so looking for the source files and built artifacts in the absolute paths where they were during compilation is a good first try. We write out absolute paths into the debug events, and then automatically append the dirname from each such path into the load path. We also update source_of_module to use an absolute path if passed one, falling back on looking for the file's basename in the usual directory search if that absolute path isn't found. (Ideally these two mechanisms would be the same, but that's a problem for another day. :))
The load path appending behavior combined with the absolute path basename fallback mean that if you happen to be debugging on a machine where the original source and build artifacts are not available in their original absolute locations, things will work as before, using the standard load path mechanism. You can also explicitly use -I to prepend directories to the load path and override the defaults located by this new mechanism.
I personally find this makes using ocamldebug much more pleasant :)
(PS: This is my second time filing a Mantis ticket and sending a patch for ocaml, and my first hasn't been responded to yet (#6267). I wasn't able to find any documentation on your preferred format for receiving patches, so I hope this is acceptable. If you prefer something else, please let me know and I'd be happy to oblige!)
File attachments
The text was updated successfully, but these errors were encountered: