ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

Spaces brake GADP attaching

Open vikke1234 opened this issue 2 years ago • 4 comments

Describe the bug If there' spaces in the path for the command line, you'll be unable to start the process because it will not find the path.

To Reproduce Steps to reproduce the behavior: 0. Have a path with spaces in it

  1. Go to the debugger
  2. Click on debug locally using GADP (I assume the same thing is happening with IN-VM
  3. See error

Expected behavior It should be able to handle spaces

Attachments If applicable, please attach any files that caused problems or log files generated by the software.

launch_request {
  path {
    e: "Inferiors"
    e: "[1]"
  }
  argument {
    name: "args"
    value {
      string_value: "/home/viktorh/.steam/debian-installation/steamapps/common/Old School RuneScape/bin/win64/osclient.exe"
    }
  }
  argument {
    name: "starti"
    value {
      bool_value: false
    }
  }
}
: java.util.concurrent.CompletionException: agent.gdb.manager.impl.cmd.GdbCommandError: <GDB/MI2 -file-exec-and-symbols "/home/viktorh/.steam/debian-installation/steamapps/common/Old"> caused '{msg=[/home/viktorh/.steam/debian-installation/steamapps/common/Old: No such file or directory.]}'

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • Java Version: ```openjdk 19.0.2 2023-01-17 OpenJDK Runtime Environment (build 19.0.2+7-Ubuntu-0ubuntu322.04) OpenJDK 64-Bit Server VM (build 19.0.2+7-Ubuntu-0ubuntu322.04, mixed mode, sharing)
 - Ghidra Version: 10.3
 - Ghidra Origin: GH

vikke1234 avatar Jun 16 '23 10:06 vikke1234

@vikke1234 Putting the path in quotes should work. (We could modify the dialog parser to handles spaces, but I don't know how we would distinguish between path spaces and arguments.)

d-millar avatar Jun 16 '23 12:06 d-millar

@d-millar I'm not familiar with how Ghidra does this behind the scenes but an idea could be to have two different input fields. One for the path to the program and one for the arguments.

vikke1234 avatar Jun 16 '23 13:06 vikke1234

Using double quotes got rid of the error (I had used single quotes earlier which did not work).

vikke1234 avatar Jun 16 '23 13:06 vikke1234

Hmmmm, looking back through our git logs, I think we attempted a fix at this problem once before. I will re-open that ticket.

d-millar avatar Jun 16 '23 13:06 d-millar

This was addressed in #5203, and I'd argue the double quotes thing is working as designed. I think the problem is that when we construct the command line for the "Quick Launch" button or for the default "Launch" arguments, we're not adding the double quotes ourselves.

nsadeveloper789 avatar Aug 07 '23 19:08 nsadeveloper789