RESOLVED FIXED226390
Add a way to prefix output of `WTFReportBacktrace` to make log filtering easier
https://bugs.webkit.org/show_bug.cgi?id=226390
Summary Add a way to prefix output of `WTFReportBacktrace` to make log filtering easier
Devin Rousso
Reported 2021-05-28 12:41:41 PDT
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.
Attachments
Patch (5.18 KB, patch)
2021-05-28 12:42 PDT, Devin Rousso
no flags
Patch (5.18 KB, patch)
2021-05-28 12:43 PDT, Devin Rousso
ews-feeder: commit-queue-
Patch (5.20 KB, patch)
2021-05-28 15:25 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2021-05-28 12:42:10 PDT
Devin Rousso
Comment 2 2021-05-28 12:43:28 PDT
Devin Rousso
Comment 3 2021-05-28 15:25:48 PDT
Megan Gardner
Comment 4 2021-06-02 12:30:52 PDT
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?
Devin Rousso
Comment 5 2021-06-02 17:33:01 PDT
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.
Devin Rousso
Comment 6 2021-06-04 10:20:44 PDT
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.
EWS
Comment 7 2021-06-04 10:58:44 PDT
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].
Radar WebKit Bug Importer
Comment 8 2021-06-04 10:59:19 PDT
Fujii Hironori
Comment 9 2021-09-12 21:16:18 PDT
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
Note You need to log in before you can comment on or make changes to this bug.