Debugging webrtc C++ code in Android Studio

1,180 views
Skip to first unread message

Luca Vitucci

unread,
Mar 16, 2018, 6:15:44 AM3/16/18
to discuss-webrtc
Hello,
I managed to compile WebRTC according to the docs on WebRTC.org, however I'm wondering if someone could help me in setting up a debugging environment on a different machine.
The problem is, I'm importing the libraries (Both the Jar and the .so) in another project where I'm using them successfully, but I can't configure Android Studio to debug native issues, as it cannot find any symbol.

What I'm trying so far:
- Setting the symbol directories to point to `out/Debug/lib.unstripped`
- Using the library from `out/Debug/lib.unstripped` in the actual app
- Pointing the symbol directories to `out/Debug/obj` and various subdirectories

My debugger simply does not stop on c++ breakpoints, does not show symbols when a crash happens inside WebRTC and does not stop on Symbolic breakpoints. Also, LLDB image won't find any symbols related to WebRTC.

I'm pretty new to debugging native libs with Android Studio, Can anyone help me with this?

Thanks.

This message is for the attention of the intended recipient(s) only. It may contain confidential, proprietary and/or legally privileged information. Use, disclosure and/or retransmission of information contained in this email may be prohibited. If you are not an intended recipient, you are kindly asked to notify the sender immediately (by reply e-mail) and to permanently delete this message. Thank you.

Sami Kalliomäki

unread,
Mar 16, 2018, 8:25:05 AM3/16/18
to discuss-webrtc
I am not aware of any way to do this in Android Studio. I use:

./build/android/adb_gdb --output-directory=out/Debug org.appspot.apprtc --cgdb

This has lots of issues though, sometimes you cannot inspect the variables etc. If you find a way to make this work in Android Studio, please let me know.


--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/adb29239-d405-45d7-bf04-0ec76a3e7944%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luca Vitucci

unread,
Mar 16, 2018, 1:02:13 PM3/16/18
to discuss-webrtc
This actually does not work for me, when pointing it to my own app (not apprtc, but obviously with the same build of webrtc) I don't get webrtc symbols in cgdb...
are you using it with a separate app or with apprtc? 
And are you using the unstripped library in the app's build?
And finally, are you maybe configuring gn with some specific flag for debugging?

I am also still trying to work with android studio and LLDB, but getting cgdb to work would be a big success.

Thanks,
Luca

Sami Kalliomäki

unread,
Mar 19, 2018, 5:01:33 AM3/19/18
to discuss-webrtc
I am using it with AppRTCMobile. I just use "is_debug = True". One thing is that I have to actually start a call in AppRTCMobile before the symbols are actually loaded.


Luca Vitucci

unread,
Mar 23, 2018, 6:07:59 AM3/23/18
to discuss-webrtc
Ok, thank you. At least now I'm able to debug, however I'm not able to print any variable (No symbol "name" in current context.), still trying to understand this one.

Peter Liu

unread,
Apr 9, 2018, 1:51:23 AM4/9/18
to discuss-webrtc
add "android_full_debug=true symbol_level=2" along with "is_debug = true" can resolve your problem.

在 2018年3月23日星期五 UTC+8下午6:07:59,Luca Vitucci写道:

Евгений Лукьяненко

unread,
Apr 11, 2021, 8:39:24 AM4/11/21
to discuss-webrtc
Hi
I solved this problem by shamanism with additional settings in Debug Configurations:
It was tested with AppRTCMobile.

Edit configuration settings -> Debugger -> Symbol directories.

("Debug type" was set "Native only" in my case)
I just added the same paths that were specified for libjingle_peerconnection_so.so:
Path_mappings.png
Debug Configurations.png

Et voila:
StackTrace.png

понедельник, 9 апреля 2018 г. в 10:51:23 UTC+5, Peter Liu:

醉翁

unread,
Jun 1, 2021, 3:15:31 PM6/1/21
to discuss-webrtc
Hi @Евгений Лукьяненко.
 I see you fix this issue.I'm same to this issue.
Could you show us about how fix this issue step by step?
thanks!

qiang wang

unread,
Jun 12, 2021, 5:40:04 AM6/12/21
to discuss-webrtc
Hi @Евгений Лукьяненко.
pls give us some detail infos.  I had config the symbol directory... , but still can't debug it. 
Reply all
Reply to author
Forward
0 new messages