Trepan-Debuggers / remake

Enhanced GNU Make - tracing, error reporting, debugging, profiling and more
http://bashdb.sf.net/remake
GNU General Public License v3.0
796 stars 75 forks source link

Debugger: "data breakpoints": break when the command executed matches a certain regex #107

Open singalen opened 4 years ago

singalen commented 4 years ago

I have a huge set of makefiles. I need to find what creates a certain directory. I would like to set a breakpoint that triggers:

The current breakpoints are useful when you know what file and line you want to stop at, but they cannot stop when a certain file is accessed.

rocky commented 4 years ago

Ok. Sounds interesting. You are up for working on it yourself?

singalen commented 4 years ago

I made some initial research in the code. This should be doable, but no promises. The condition should be checked somewhere around start_job_command(), and I need to call enter_debugger() - is this correct?

rocky commented 4 years ago

I'd stay out of src which is mostly GNU Make and work as much as possible in libdebugger

To get started I might modify info targets so that instead of printing everything it filters according to some pattern. But no promises ;-)

singalen commented 4 years ago

Sorry, how would it help to create a data breakpoint? To be clear, I don't want to filter existing breakpoints by condition. I want to have a pure-data breakpoint, that triggers whenever ANY command matches a given regex.

To do this, I need to:

Does this sound reasonable?

rocky commented 4 years ago

Ok - I think I see now. So yes, I think new_job in jobs.c is where you want to change.

And what you write sounds reasonable.

Still though, you would do well to change job.c a little as possible. It's already complicated and ugly enough. If you can just put inside new_job a call to a new routine inside libdebugger to make the additional check and trigger when true.