Samsung / netcoredbg

NetCoreDbg is a managed code debugger with MI interface for CoreCLR.
MIT License
825 stars 104 forks source link

How to set a launchprofile? #68

Closed MikaelElkiaer closed 2 years ago

MikaelElkiaer commented 3 years ago

The dotnet run command has a parameter --launch-profile which can be set, referring to a profile defined in Properties/launchSettings.json. Can I somehow set this parameter when starting a program with netcoredbg?

o-lek commented 3 years ago

Hello, MikaelElkiaer! I'm afraid, currently there is no way to pass any arguments to dotnet run command. You can start your application as usual and then attach the netcoredbg to it. UPD: You should start netcoredbg from your app's working directory in order it can find .pdb file and then issue a command ncdb> attach <pid>

MikaelElkiaer commented 3 years ago

Ok, was hoping to avoid this since I cannot find a way to wait for the debugger without adding some statement to my code.

alpencolt commented 3 years ago

@MikaelElkiaer we'll add this feature, but now you can write simple shell script which run your application, search pid of applications using ps and next attach NCDB. Its very fast and you'll lose only few milliseconds after start. If you need some initial setup for debugger you can write such commands to text file and pass to debugger:

netcoredbg --attach <pid> --command=<command_file>
MikaelElkiaer commented 3 years ago

@MikaelElkiaer we'll add this feature, but now you can write simple shell script which run your application, search pid of applications using ps and next attach NCDB. Its very fast and you'll lose only few milliseconds after start. If you need some initial setup for debugger you can write such commands to text file and pass to debugger:

netcoredbg --attach <pid> --command=<command_file>

Thank you, sounds good with both future prospects and current method.

o-lek commented 2 years ago

@MikaelElkiaer, you can now set dotnet run parameters in 2 ways:

  1. pass them as netcoredbg arguments: $>netcoredbg [netcoredbg params] [-- dotnet run [run params]] [-- [your_app_params]]
  2. set them by set args command: ncdb> file dotnet ncdb> set args run [run params] [-- [your_app_params]]
MikaelElkiaer commented 2 years ago

@o-lek Awesome, thanks! When will it be released?

o-lek commented 2 years ago

@MikaelElkiaer, It's already there. You can try it right now.

MikaelElkiaer commented 2 years ago

It seems to be working, awesome, thanks.

Just to sate my massive confusion? So this was possible all along? I mean, I don't see any relevant updates, anywhere...

o-lek commented 2 years ago

So this was possible all along? I mean, I don't see any relevant updates, anywhere...

Seems like that. Fortunately, it was implemented by our colleague who has left our team some time ago. My mistake is that I didn't know about it, I'm very sorry. So, when I started "implementation" a day ago, the only thing I had to do is to check that it works right.