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
Extend/replace implementation with ruby/debug's tracers? #8
Comments
I have no opinion about that. I'm not sure how many people use the current implementation. |
Yeah given that it only has 200k downloads, it probably doesn't have many users. And the current implementation is pretty outdated so it won't be too helpful for most users. I've discussed about this with @ko1 and he doesn't want to maintain the debugger tracers in a separate gem. So I guess it's one less incentive to update this project. Perhaps it's ready to be deprecated? 🤔 |
Hey @st0012 I quite like the idea as well. Also to make it extensible. Tracer has a lot of potential, but we need to find a good way of actually showing partial traces in a nice way. I also like the block-style you've mentioned. We could definitely give it more love. |
@thiagofm I'm glad that you like the idea! Given my past experience building object_tracer, I'm definitely behind having a simple tracing library vs always loading the debugger just for tracing. I now mainly use debugger(do: "trace call")
# stuff
debugger(do: "trace off") to mimic the block API I imagined, which is a bit clunky. But I think it ultimately comes down to how many users will use this if we put more effort on it. I'm actually quite surprised that you found this issue because I don't know much developers using tracers. Do you know any other Rubyists that use tracing for debugging? |
(skip this if you are just skimming through the issue, it's a bit offtopic) @st0012 hey there! To be honest, it's a topic I think about often, or debuggers themselves, like reverse debuggers. Also, I think many developers end up using tracing in a way or the other, one common being like an exception tracker or tools like Datadog or New Relic. Every developer in the world has bugs to fix or understand code 😄 I think currently, what we are used to in Software Development(from printing statements to debugging), we are not there yet. There's probably a better way of seeing the executing of a program that doesn't involve setting many breakpoints and would let you navigate this. Or Trace. There's a lot of cargo-cult in the debuggers/tracers that we use day to day and little innovation. On tracing, so you wrap some code around and see what happened. The thing is, currently tracing is very clunky. Most of it you want actually filtered out, but if you filter too much, you might end up with an issue. Debuggers with "next" functionality try to achieve some of it, but you miss too much context. Sometimes you use "next" and end up somewhere you didn't want. Ideally, tracing is actually better than debugging if it wouldn't be so clunky. My thought is, how to remove the clunkiness from tracing in a smart way? Btw, let's move this discussion somewhere else 😄 Send me an e-mail at thiagown @ gmail, let's have a chat. |
I feel this discussion is actually relevant to the issue because there's very few discussion about (development) tracing! To me, debugging usually consists of 2 steps: explore and locate.
This is because in reality, our programs have many code paths, and we rarely know the exact code path that triggers the bug from beginning to end. So step 1 is to find the code path, and step 2 is to find the problematic method (usually) on that code path. I think currently many devs use breakpoint for both phases, which does the job but not efficient. Breakpoint pins on a single point so it works really well on one path (think about (I know you already know these but I just want to vent them out 😛) So how do we make tracing accurate enough? The thing I'm pushing for is to create different tracers for different targets instead of always start from tracing method calls. That's why we have these in the debugger
So I'm already doing something like this:
Now you may think "so it looks like tracers need to be used with breakpoints, why do we want to extract them?". It's because:
To wrap up: I'm totally confident that we can make tracers not clunky and practical to use (which I think is already true for |
@hsbt @ko1 If you are not oppose to this project, I'd like to start working on this project as an outside collaborator. I will use As for substituting |
I have no opinion too. Now tracer.rb is not bundled with Ruby package, so it is one of gems.
the author seems Ishituka-san. |
@ko1 Thank you for the information. I've wrote him a letter 👍 |
It's been a month since I sent the email, but I still got no feedback. I guess it's a no then 😞 |
I recently implemented the extraction in my I'll use it to explore:
I also found that it's a lot easier to write tests after the extraction, and therefore found a few |
I discussed this with @st0012. I'm okay to replace this repository and rubygems with @st0012 How about the following instructions for replacing
|
@hsbt The plan looks great, thank you 👍 And in step 5 I have these todos:
|
@st0012 👋 I finished to do with 1-4. Let me know if you have any concerns. |
@hsbt Thank you for the help! I've completed the remaining steps 😄 |
ruby/debug has 4 types of tracers:
LineTracer
CallTracer
ExceptionTracer
ObjectTracer
All of them are super powerful and the implementation is mostly debugger-independent. With a few tweaks they can be completely extracted. So I'm thinking maybe we can move those tracers here so users can use it without the debugger? With API like
And we can support 2 ways to turn it on/off
And the debugger can depend on this gem, similar to it depends on
irb
andreline
.Benefits
irb --tracer
can be more powerfulWe need to think about coloring more carefully though. Ideally, the updated tracer should support out-of-box coloring. But it means we need to replicate the
irb
's coloring logic because we can't depend onirb
. Perhaps extracting that to acolorable
utility gem will be better in the long-term?Wdyt? @ko1 @hsbt
The text was updated successfully, but these errors were encountered: