| Summary: | Add a way to prefix output of `WTFReportBacktrace` to make log filtering easier | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Devin Rousso <hi> | ||||||||
| Component: | Tools / Tests | Assignee: | Devin Rousso <hi> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | benjamin, cdumez, cmarcelo, ews-watchlist, hi, Hironori.Fujii, megan_gardner, thorton, webkit-bug-importer, wenson_hsieh | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 230207 | ||||||||||
| Attachments: |
|
||||||||||
Created attachment 430042 [details]
Patch
Created attachment 430043 [details]
Patch
Created attachment 430062 [details]
Patch
Comment on attachment 430062 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430062&action=review > Source/WTF/wtf/Assertions.cpp:291 > void WTFReportBacktrace() Could you make it so this isn't duplicated code? Comment on attachment 430062 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430062&action=review >> Source/WTF/wtf/Assertions.cpp:291 >> void WTFReportBacktrace() > > Could you make it so this isn't duplicated code? I thought about doing this by having `WTFReportBacktrace` call `WTFReportBacktraceWithPrefix("")`, but I think the issue there is that we'd then want to adjust `framesToSkip`. I'll take a stab at maybe using a `template` or something. Comment on attachment 430062 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430062&action=review >>> Source/WTF/wtf/Assertions.cpp:291 >>> void WTFReportBacktrace() >> >> Could you make it so this isn't duplicated code? > > I thought about doing this by having `WTFReportBacktrace` call `WTFReportBacktraceWithPrefix("")`, but I think the issue there is that we'd then want to adjust `framesToSkip`. I'll take a stab at maybe using a `template` or something. Turns out that I can't use a `template` because it's `extern "C"` :/ I did experiment with something like `#define WTFReportBacktrace() WTFReportBacktraceWithPrefix("")`, but it was pointed out to me that that could have issues if WebKit clients (e.g. Safari) depend on that symbol. Committed r278474 (238492@main): <https://commits.webkit.org/238492@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 430062 [details]. Comment on attachment 430062 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430062&action=review > Source/WTF/wtf/StackTrace.h:104 > + const char* m_prefix; Adding a new member here is problematic. Filed: Bug 230207 – StackTrace outputs a garbage prefix because WTF::StackTrace::m_prefix is filled with the stack content |
Often times while debugging I add `WTFLogAlways("<DR> ...")` to various places as indicators that "logic has reached here". This is especially useful when debugging iOS as unlike macOS there's no console output from `run-safari`, meaning that I have to use system logging, which is often a deluge of unrelated information. Having "<DR>" as a prefix makes filtering through the system logging trivial as I can ignore logs that don't have it. Unfortunately, `WTFReportBacktrace` does not have a way to add this prefix, so it becomes much harder to find in the logs.