Help! Using CodeLite like gdb, to debug a DLL running in R?
Posted: Wed Aug 08, 2012 4:13 am
Codelite v4.0.5589 on Windows (not self-built, I just downloaded the exe)
Am looking for help in recreating in CodeLite something that I can currently do in gdb - basically, linking gdb with an R session (R as in the statistical programming language), and then stepping through the code of an existing dll, using the inputs defined in the R session.
To explain further, I have a cpp source file and its associated dll, which has been compiled using g++ with debugging enabled (note: this was done within an adapted version of cxxfunction, which is part of the Rcpp package in R, but the main thing is that I have a .cpp file and a .dll file and all the debugging stuff is enabled).
Now, I've found I can debug the dll (let's call it example.dll) line by line using gdb be doing the following steps:
1. In a command prompt, change directory to the location of the dll (e.g. C:/mydll/)... note the cpp source example.cpp is also in this folder
2. Then enter "gdb Rgui.exe" (which starts up a gdb session) and then "run" (which starts up R in the background)
3. Load up example.dll into R using the command "dyn.load('C:/mydll/example.dll')"
4. Break back to the gdb (there is an option in the R pulldown menus to do this)
5. Set a breakpoint in gdb by entering "b example"
6. Enter "c" (for continue) in gdb, which passes control back to R
7. Call the dll within R using a command like ".Call("example",3)" where 3 is the input value to the dll
8. The dll automatically pauses and control passes to gdb, where you can view the code line by line, interrogate variables, etc
As you can see, quite a few steps, but nothing very difficult - the gdb session is able to communicate with R and whatever inputs are put in the ".Call", the dll freezes and gdb takes control.
I'd like to recreate this behaviour using CodeLite as by all accounts this would be a much more friendly debugging environment.
I think it could be something to do with "Attach to process" but I'm really confused. Please help - any pointers would be very much appreciated!
Cheers
Tim
Am looking for help in recreating in CodeLite something that I can currently do in gdb - basically, linking gdb with an R session (R as in the statistical programming language), and then stepping through the code of an existing dll, using the inputs defined in the R session.
To explain further, I have a cpp source file and its associated dll, which has been compiled using g++ with debugging enabled (note: this was done within an adapted version of cxxfunction, which is part of the Rcpp package in R, but the main thing is that I have a .cpp file and a .dll file and all the debugging stuff is enabled).
Now, I've found I can debug the dll (let's call it example.dll) line by line using gdb be doing the following steps:
1. In a command prompt, change directory to the location of the dll (e.g. C:/mydll/)... note the cpp source example.cpp is also in this folder
2. Then enter "gdb Rgui.exe" (which starts up a gdb session) and then "run" (which starts up R in the background)
3. Load up example.dll into R using the command "dyn.load('C:/mydll/example.dll')"
4. Break back to the gdb (there is an option in the R pulldown menus to do this)
5. Set a breakpoint in gdb by entering "b example"
6. Enter "c" (for continue) in gdb, which passes control back to R
7. Call the dll within R using a command like ".Call("example",3)" where 3 is the input value to the dll
8. The dll automatically pauses and control passes to gdb, where you can view the code line by line, interrogate variables, etc
As you can see, quite a few steps, but nothing very difficult - the gdb session is able to communicate with R and whatever inputs are put in the ".Call", the dll freezes and gdb takes control.
I'd like to recreate this behaviour using CodeLite as by all accounts this would be a much more friendly debugging environment.
I think it could be something to do with "Attach to process" but I'm really confused. Please help - any pointers would be very much appreciated!
Cheers
Tim