How to Debug a C# program with LLDB?
from dr_robotBones@reddthat.com to programming@programming.dev on 08 Jun 21:34
https://reddthat.com/post/67165398

I found few resources online which may have lead me astray, as I can’t get even basic functionality out of LLDB.

I used the dotnet-sos tool to supposedly automatically load SOS into LLDB and I attached LLDB to my program’s process, but I am getting errors when trying to use any command:

error: 'bpmd' is not a valid command.
error: 'clrstack' is not a valid command.

Its behaving as if SOS isn’t installed, I think? I really don’t know what is going on, searching for these errors gives me nothing which is insane, usually there would be GitHub issues or Stack Overflow posts. I think I’m about to never touch C# ever again.

#programming

threaded - newest

terabyterex@lemmy.world on 09 Jun 00:42 collapse

which OS? i’ll assume linux for my first answer. check the .llldbinit file. see if the dotnet-sos put itself in there.

dr_robotBones@reddthat.com on 09 Jun 01:19 collapse

Yes I’m on linux, my .lldbinit does have a path to the libsosplugin.so file, and I’ve confirmed the file is real.

terabyterex@lemmy.world on 09 Jun 01:46 collapse

try manually loading the plugin.

in an lldb session i THINK its - plugin load ~/.dotnet/sos/libsosplugin.so (i looked up the path since i am on the phone)

dr_robotBones@reddthat.com on 09 Jun 02:16 collapse

That worked! Though I had to use the absolute path rather than the tilde. Is lldb not properly sourcing the config file?

terabyterex@lemmy.world on 09 Jun 02:17 collapse

its possible. just to make sure, you started a new session after installing dotnet-sso? what is the path in the .lldbinit file?

dr_robotBones@reddthat.com on 09 Jun 02:35 collapse

Yeah it was a new session. The .lldbinit file is in my home folder, at ~/

terabyterex@lemmy.world on 09 Jun 02:39 collapse

i mean inside the init file, is the fotnet-sdo path right? i think the init file isnt loading it correctly

dr_robotBones@reddthat.com on 09 Jun 02:41 collapse

it only has the plugin load command and setsymbolserver -ms

terabyterex@lemmy.world on 09 Jun 02:45 collapse

wait - does the plugin load have the path you used in your manual call to get it working? it needs to mimic that call

dr_robotBones@reddthat.com on 09 Jun 02:48 collapse

Yeah its the exact same path

terabyterex@lemmy.world on 09 Jun 02:56 collapse

ok here is my last swing. your init file isnt being called. are you running lldb with sudo? try running with out sudo (if you erte) but , put an echo statement in the init file like “init test” to make sure its being called.

dr_robotBones@reddthat.com on 09 Jun 03:27 collapse

Oh that makes sense, yeah I’ve been running it as sudo, I’m pretty sure its looking for the init file in /usr then. I’ve had the same problem with vim in the past.