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

More work on xtrace #891

Open
7 tasks
andychu opened this issue Jan 20, 2021 · 3 comments
Open
7 tasks

More work on xtrace #891

andychu opened this issue Jan 20, 2021 · 3 comments

Comments

@andychu
Copy link
Contributor

andychu commented Jan 20, 2021

continuing from #583

  • special first and last line
    • first: PID. Maybe also: hostname, username, and absolute start time (unlike timestamp which is relative?)
    • last: status
  • Trace across xargs $0
    • maybe AUTOMATICALLY export SHX_indent, SHX_pid_str, SHX, etc.
    • not included: SHX_punct
  • BASH_XTRACEFD or SHX_file_desc
    • then all processes at once can trace here?
    • { BASH_XTRACEFD=$fd $0 -x myscript.sh } {fd}>out.txt
  • $SECONDS for COARSE profiling
    • you can remove all the "spans" that are smaller than that
  • fix SHELLOPTS bug? Sometimes it says "no such option"
  • PARSE traces and make a diagram
    • flame graph? That only works for a single thread
  • It would be nice to trace redirects. This came up while trying to figure out what's going on with OSH running sharness. It does a lot of redirects to descriptor 2, 3, and 4, and it uses BASH_XTRACE_FD.
  • Idea from Better tracing for Oil #583: custom proc hooks? Or is PS4 good enough?
@andychu
Copy link
Contributor Author

andychu commented Jan 24, 2021

ShellSpec could use BASH_XTRACEFD.

@andychu
Copy link
Contributor Author

andychu commented May 13, 2021

Actually xtrace_rich did help in debugging sharness! It traced it to a subshell exiting 1.

Also sharness uses BASH_XTRACE_FD, so we should probably implement it.

@andychu
Copy link
Contributor Author

andychu commented May 13, 2021

I'm confused: I see forkwait of the same process TWICE here. I think this is a buffering issue with fork(). I think we need a flush() somewhere.

Yeah I think if the tracer is shared across fork, it needs to flush.... gah.

842  osh -x -O xtrace_rich --debug-file _tmp/debug --xtrace-to-debug-file ./fail.t    -x

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

1 participant