gdbgui icon indicating copy to clipboard operation
gdbgui copied to clipboard

GDBGUI on windows incorrect path for loading source file

Open sepavel opened this issue 7 years ago • 5 comments
trafficstars

Hello,

Steps to reproduce:

  1. Specify exe file and press "Load binary"
  2. Press "Fetch source files"
  3. Click on any source file

You will get and error "expected to find source file" in the following JS code

get_body() {
    const states = constants.source_code_states;
    switch (this.state.source_code_state) {
      case states.ASSM_AND_SOURCE_CACHED: // fallthrough
      case states.SOURCE_CACHED: {

        let obj = FileOps.get_source_file_obj_from_cache(this.state.fullname_to_render);
        if (!obj) {
          console.error("expected to find source file");

where this.state.fullname_to_render will contains "/C:\Folder\Filename.cpp" instead of "C:\Folder\Filename.cpp"

sepavel avatar Aug 22 '18 17:08 sepavel

I believe you may be able to remap the sources to make this work. Something like

gdbgui --remap-sources='{"/": ""}'

cs01 avatar Sep 30 '18 04:09 cs01

Hi,

I am getting this too. I am having to map file paths from unix to windows, eg:

gdbgui -r --remap-sources='{"/home/dev/blah/develop":"c:/dev/develop"}'

I have tried all sorts of combinations but it always sticks a '/' in front of the windows file path. I tried mapping to "dev/nos-develop" which produced filenames like "/dev/blah/develop/app/builds/../main.cpp" etc which also didn't work, but I'm not sure if it was the lack of "c:/" that was the problem or the parent dir "/../" bit.

Great piece of software though!

blitz-research avatar Dec 18 '18 04:12 blitz-research

I'm having the same problem using Mingw where the linux style root slash added before the drive letter prevents source files from loading. I tried the remapping option from "/" to "" but It doen't seem to change anything. If there is anywhere in the source I could try contributing to, I would be glad to help.

orazdow avatar Feb 23 '19 04:02 orazdow

Thanks for the offer. If you open the chrome developer tools and monitor the network communication, you can see the urls and parameters being requested. Assuming the requested file path has the "/" prefix, you can look at the url and grep for it in the codebase (is it possible gdbgui is requesting a normal path and Mingw is adding the prefix?).

From there, you can find where the request was made and put a breakpoint in. After the breakpoint is there, you can run again and hit the breakpoint. At that point you can walk back up the stack and see if/how the original url is transformed into a url with the '/' prefix.

cs01 avatar Feb 23 '19 04:02 cs01

I'm having the same issue on my Windows 10 machine. Paths get '/' prefixed in front of them for some reason and cannot open files with following error file not found: /C:\dev\....

Kazhuu avatar Sep 03 '19 12:09 Kazhuu