Replies: 5 comments 3 replies
-
|
I'm also unable to get Ghidra to start the target with a different working directory, which is required for the application to run. The potential solution I found on this link to launch Ghidra from the desired working directory is not working. |
Beta Was this translation helpful? Give feedback.
-
|
@mxtsdev There are probably a number of ways to approach each of your issues. For instance, if you don't need to debug the target from start-up, you can start the target as you normally would with the appropriate arguments and starting directory, and then attach to the running process. Assuming that doesn't work for you, try the following: (1) In the Target window, start dbgeng. WIll caveat all this with a note that some of these things have only recently been fixed. I tested them in our main branch and am pretty sure all of the above works in 10.3.2, but for older versions your mileage may vary. |
Beta Was this translation helpful? Give feedback.
-
|
I will spend a bit more time on this later today, but one quick note: I forgot when I comment in GitHub that double backslashes are converted to single slashes. The same is true in Java, i.e. my example should be C:\\Program Files, etc. |
Beta Was this translation helpful? Give feedback.
-
|
OK, verified what I should have remembered - 10.3.3 is broken with regard to the Launch Process connector. There may be a workaround - am looking into that - but the bug was pointed out recently and the fix did not make 10.3.3. The bug has been fixed in the main branch. Not sure how ambitious you're feeling, but can definitely help walk you through the build process if you're interested and/or need help. In the main build (and, I believe, the next release), setting the working directory using "dir" works. For example, if I run "C:\\Windows\\System32\\cmd.exe with dir: C:\\Tmp, the cmd shell opens at C:\Tmp and tlist.exe gives the correct version for CWD. That said, am pretty sure there is another use case where the working directory is not the relevant variable and you have to do something like env: cd=C:\\Tmp or similar. Again, you'll probably have to verify this for your specific use case. That may also provide a workaround for the path for the arguments as, given a relative (and possibly dotted) path, I believe it will prepend the working directory, which can have spaces in it. Interestingly, having gone through the code again, it appears the problem with spaces in the arguments is actually a limitation of the Windows dbgeng API. Specifically, the command line gets passed pretty much as is by Ghidra into IDebugClient::CreateProcessAndAttach2's CommandLine parameter. So not sure what to do about that.... |
Beta Was this translation helpful? Give feedback.
-
|
I stand corrected - and, thanks, that example was extremely helpful. The issue (as you actually suggested early on) was that the logic leading to the dbgeng API call was stripping quotes, which are definitely necessary for the call to operate correctly. Will let you know when it makes its way into master. You'll still have to build master, as it'll be a while before it hits the release, but should solve both of your issues, not to mention other folks'. Much appreciated! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm attempting to run the debugger (IN-VM dbgeng) on a target with an input file supplied in the command line arguments. The file path contains spaces, and I can't seem to find any working method to escape it.
Does Ghidra not support this?
Beta Was this translation helpful? Give feedback.
All reactions