Hi Everyone,
I noticed that I can set the source directory via the `dir` command in winedbg, but, for some reason, it rejects absolute paths, like Z:\bla\blah, claiming that ":" is a syntax error. I tried to enclose the path in quotes / double quotes, but then the quote / double quote is rejected as a syntax error. I don't have sufficient knowledge of bison to grok the code in programs/winedbg/dbg.y, so is there a way to escape the colon symbol?
As a workaround, I mapped my build directory under Wine, but that is really annoying.
Thank you, Mihai Todor
Update: I figured it out after studying the winedbg code in more detail.
It turns out that the "syntax error" was misleading, because winedbg is able to match against Linux paths just fine. No need to use Windows paths. Even better, it's more powerful than I expected, since it can do partial matches on the paths. In detail:
1. There is a mechanism in `source_add_file` from programs/winedbg/source.c for creating a cache (linked list) of "open files" and each node from this list contains, among other things, the real path of the code file, if this file can be located. Otherwise, this path is set to NULL and it cannot be overwritten afterwards for the duration of the debug session. Hence, the user needs to set the symbol path before any breakpoint is hit, since `source_add_file` is invoked when the application triggers a breakpoint.
2. Calling `dir linux_absolute_path_to_the_source_code_root_folder` at the start of the debug session *does the right thing*, because `source_locate_file` from programs/winedbg/source.c is able to perform, through `SearchPathA`, "clever" partial matching against the available source directories (set via the `dir` command). For example, if the desired code file is "c:\build\myapp\core\utils\utils.cpp", mapping the contents of the "c:\build" folder to "/media/sf_build" and calling under winedbg `dir /media/sf_build/myapp` at the beginning of the debug session will allow the debugger to locate the source code when, for example, a break point is hit.
Hope someone will find this extra information useful some day.
Best regards, Mihai Todor
On Mon, Oct 30, 2017 at 7:56 PM, Mihai Todor todormihai@gmail.com wrote:
Hi Everyone,
I noticed that I can set the source directory via the `dir` command in winedbg, but, for some reason, it rejects absolute paths, like Z:\bla\blah, claiming that ":" is a syntax error. I tried to enclose the path in quotes / double quotes, but then the quote / double quote is rejected as a syntax error. I don't have sufficient knowledge of bison to grok the code in programs/winedbg/dbg.y, so is there a way to escape the colon symbol?
As a workaround, I mapped my build directory under Wine, but that is really annoying.
Thank you, Mihai Todor