mono / sdb

A command line client for the Mono soft debugger.
https://www.mono-project.com
MIT License
116 stars 44 forks source link

Remote debugging in sdb #8

Closed Alphapage closed 10 years ago

Alphapage commented 10 years ago

Hello,

Does sdb support remote debugging ? I can't find any info about such a feature.

Thanks in advance for your answer.

alexrp commented 10 years ago

Yes:

$ sdb
Welcome to the Mono soft debugger (sdb 1.0.5064.21728)
Type 'help' for a list of commands or 'quit' to exit

(sdb) listen 192.168.87.108 12345
Listening on '192.168.87.108:12345'...
Inferior process '0' ('192.168.87.108:12345') started
Inferior process '0' ('192.168.87.108:12345') suspended
#0 [0x00000018] Mono.Samples.Hello.HelloActivity.OnCreate at /home/alexrp/Projects/monodroid/monodroid/samples/Hello/Hello.cs:344
            Log.Info ("MonoDroid-Timing", "HelloActivity.OnCreate: time: {0}", (DateTime.Now - new DateTime (1970, 1, 1)).TotalMilliseconds);
(sdb) bt
#0 [0x00000018] Mono.Samples.Hello.HelloActivity.OnCreate at /home/alexrp/Projects/monodroid/monodroid/samples/Hello/Hello.cs:344
            Log.Info ("MonoDroid-Timing", "HelloActivity.OnCreate: time: {0}", (DateTime.Now - new DateTime (1970, 1, 1)).TotalMilliseconds);
#1 [0x00000013] Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ at /home/alexrp/Projects/monodroid/monodroid/src/Mono.Android/platforms/android-18/src/generated/Android.App.Activity.cs:2178
            __this.OnCreate (savedInstanceState);
#2 [0x00000017] object.4ffcc7aa-4e1f-4cfd-a486-8443b16f31bd
(sdb) p Android.Runtime.JNIEnv.Handle
System.IntPtr it = 0x414e9470
Alphapage commented 10 years ago

Great. Wonderful feature. Do you have an example with Ubuntu and mono app instead of xamarin monodroid. ? Which configuration do you use ?

alexrp commented 10 years ago

It's the same thing. Run Mono with the appropriate --debugger-agent option, e.g. --debugger-agent=transport=dt_socket,address=<ip>:<port>. Append ,server=y if you want to connect to the debuggee instead of the debuggee connecting to the debugger.

See mono --debugger-agent=help.