Re-structured ShowCallstack

Nov 12, 2009 at 12:54 PM
Edited Nov 12, 2009 at 12:57 PM

I've submitted a patch on http://stackwalker.codeplex.com/SourceControl/PatchList.aspx , see patch 4414. (and 4415)

The issue I had was this: the logging mechanism in my library emits a timestamp and some other information with each line of output.  In some exceptional cases, I will emit the callstack to that log. The original ShowCallstack emits one stack frame per line, and as a result, I get a stacktrace that (a) is marked up with lots of timestamps and (b) is interleaved with other unrelated timestamped messages being sent to the log by other threads.

2009-11-11 08:08:12  T001 - stacktrace line 1
2009-11-11 08:08:12  T001 - stacktrace line 2
2009-11-11 08:08:12  T002 - unrelated log message
2009-11-11 08:08:12  T001 - stacktrace line 3
2009-11-11 08:08:12  T002 - unrelated log message #2
 ...

 

I wanted to insure the stacktrace could be generated and emitted to the log as one unit, not as N independent lines of text. 

2009-11-11 08:08:12  T001 - stacktrace line 1
stacktrace line 2
stacktrace line 3
stacktrace line 4
stacktrace line ...
stacktrace line N
2009-11-11 08:08:12  T002 - unrelated log message
2009-11-11 08:08:12  T002 - unrelated log message #2
 ...

Check it out and let me know what you think.

 

Coordinator
Nov 13, 2009 at 10:32 AM

Hi!

From my point of view, it is abad idea to change the stackwalker in order to accomplish your task...

It is very easy to just store the line-infos (line-by-line) into a std::string an dthe on the last call, put this stored lines into the Log.

So, I do not need to see a reason to accept this patch.

Greetings

  Jochen

Marked as answer by jkalmbach on 9/16/2014 at 5:22 AM