2009-11-20 14:44:55     How to get the backtrace in application

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-11-20 14:44:55     How to get the backtrace in application

Emil Bart (POLAND)

Message: 82603   

 

Hello,

 

I'm writing an application for uClinux which is running under blackfin processor. I would like to find a way of  storing data which help me to find the line in source code where my application crashed. Under linux it is possible  to store a backtrace during crashing the application calling backtrace function. I tried the same under uClinux but I see that it is not possible. My question is if there is another way to store backtrace to the file when application crashes. I also figured out that the blackfin processor has hardware trace and it prints it on console when application crashes. Is any way to store harware trace to file in application ? Any advices will be appreciated.

 

Emilbart,

QuoteReplyEditDelete

 

 

2009-11-20 14:48:46     Re: How to get the backtrace in application

Mike Frysinger (UNITED STATES)

Message: 82604   

 

the backtrace functions in glibc have not been ported to uClibc.  there are no workarounds here other than to implement the backtrace functions yourself.

 

if you want to save the hwtrace output automatically, then simply read the kernel log buffer.  use `dmesg` or the syslog() functions.

QuoteReplyEditDelete

 

 

2009-11-20 16:03:01     Re: How to get the backtrace in application

Emil Bart (POLAND)

Message: 82605   

 

Mike, thanks for reply.

 

But if I read the dmesg (I don't know which file to read) in signal handler (signal is received because of crash) will I get the hardware trace for my application? Or it is too early to read dmesg and I should do it after terminating my application.

 

Can you write something more about syslog functions? I know only that I can run syslogd and read the logs in /var/log/messages. But can I read the logs in  program ?

QuoteReplyEditDelete

 

 

2009-11-20 17:16:08     Re: How to get the backtrace in application

Mike Frysinger (UNITED STATES)

Message: 82606   

 

the hwtrace is written before the signal is delivered to the faulting applicatiion

 

check out the man page for the syslog function.  it has no direct relationship to the syslogd program.

Attachments

    Outcomes