[android-developers] Re: Is that possible to print backtrace when debug native code
If you want to just print a log line, you can do this with the log.h
library:
#include <android/log.h>
__android_log_print(ANDROID_LOG_DEBUG, "Category", "Your message");
But you won't get a stack trace (I'm assume from backtrace you mean
stack trace?)
If you are trying to handle "exceptions" in C++ then I think you're
out of luck:
http://groups.google.com/group/android-ndk/browse_thread/thread/89db67ed1fbf6450/6f156e8cd5b27193
You can however parse and interpret the native error trace with some
degree of success:
http://code.google.com/p/android-ndk-stacktrace-analyzer/
On Nov 24, 12:15 am, DanH <danhi...@ieee.org> wrote:
> There's no generic C/C++ facility for that -- it would be system-
> specific (if it exists at all).
>
> On Nov 23, 3:45 am, "A.TNG" <tang.j...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi All,
>
> > When I debug android app, if I work with Java, I can use Log.d("TAG",
> > "xxxx", new Throwable()) to print backtrace of Java code. This is
> > really handy for me to find bugs. But when I work with native library
> > (e.g. libwebcore.so), there seems no way to print backtrace in
> > runtime. The only way to debug native code is use gdbserver.
>
> > I have a question. Is there any way to print backtrace in C/C++? If
> > you have any idea, please share with me. Thanks a lot.
>
> > --
> > Regards,
> > Jiyu
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home