0

The base::debug::StackTrace can NOT print the Backtrace of function call sequence neither by the interface PrintBacktrace() or OutputToStream() with Cobalt QA version, so is there a way to print the backtrace with Cobalt QA version?

jrbedard
  • 3,662
  • 5
  • 30
  • 34
bitchainer
  • 535
  • 2
  • 19

1 Answers1

0

In src/base/debug/stack_trace_starboard.cc, StackTrace::PrintBacktrace() passes the stack into a PrintBacktraceOutputHandler, which ultimately outputs to SbLogRaw(), which in src/starboard/shared/posix/log_raw.cc should write() to STDERR_FILENO, regardless of build type.

When I try this in linux-x64x11_qa Cobalt:

base::debug::StackTrace().PrintBacktrace();
LOG(INFO) << base::debug::StackTrace().ToString();

I get two stack traces printed:

    SbEventHandle [0x4158e4]
    starboard::shared::starboard::Application::DispatchStart() [0x4933b8]
    starboard::shared::starboard::Application::Run() [0x49330e]
    main [0x48c248]
    <unknown> [0x7f272613cf45]
    <unknown> [0x4156b9]
    <unknown> [0x4156b9]
[0113/132642:INFO:main.cc(37)] SbEventHandle [0x415950]
    starboard::shared::starboard::Application::DispatchStart() [0x4933b8]
    starboard::shared::starboard::Application::Run() [0x49330e]
    main [0x48c248]
    <unknown> [0x7f272613cf45]
    <unknown> [0x4156b9]
    <unknown> [0x4156b9]

Since this ultimately writes out to SbLogRaw(), I'd look at how that is behaving in QA builds to see what your problem is.

David Ghandehari
  • 534
  • 3
  • 12
  • I checked the code again with your clue, and changed the write fucntion to fprintf , and it can print the log to the console now, may be the system has not redirected the output of the write fucntion to console yet. Thanks so much for your kind help! – bitchainer Jan 16 '17 at 03:09