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

Have an option to trace only a range of lines #3

Open
mingodad opened this issue Jan 11, 2024 · 2 comments
Open

Have an option to trace only a range of lines #3

mingodad opened this issue Jan 11, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@mingodad
Copy link

When testing with non trivial source code the output of trace -tr can be long and sometimes we are only interested in a range of lines, would be nice to have a way to specify it, maybe something like:

ccparse -tr printAST,35119-35127 sqlite3.pp2.c
@mingodad
Copy link
Author

For example executing ccparse -tr printAST sqlite3.pp2.c > sqlite3.pp2.c.ast result in a file of 203MB.

@smcpeak smcpeak added the enhancement New feature or request label Jan 11, 2024
@smcpeak
Copy link
Owner

smcpeak commented Jan 11, 2024

Seems like a reasonable idea and not too hard to implement. The interface should probably not use -tr, which is a general-purpose tracing facility that doesn't know about line numbers, etc. Instead, I think I'd do something like:

ccparse --range-trace printAST,35119-35127

However, when I have a need along these lines, what I typically do is first try to obtain an input file that is as small as possible while still demonstrating some behavior of interest. The "delta" tool at https://github.com/dsw/delta can do this automatically in many cases. Consequently, I'm normally working with input files that are small enough that further restriction based on line number is unnecessary.

Just to set expectations, I probably won't work on this, but you (or anyone else) are welcome to submit a pull request.

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

No branches or pull requests

2 participants