setting a breakpoint on a dll, relative path or absolute path issue
Jeffrey Walton
noloader@gmail.com
Tue Jun 14 04:22:00 GMT 2011
On Mon, Jun 13, 2011 at 11:45 PM, Asm warrior <asmwarrior@gmail.com> wrote:
> On 2011-6-14 11:10, Asm warrior wrote:
>>
>> On 2011-6-14 0:59, Eli Zaretskii wrote:
>>>>
>>>> Date: Mon, 13 Jun 2011 14:29:28 +0800
>>>> > From: Asm warrior<asmwarrior@gmail.com>
>>>> > CC: "John E. / TDM"<tdragon@tdragon.net>, Eli Zaretskii<eliz@gnu.org>,
>>>> > jan.kratochvil@redhat.com,keiths@redhat.com
>>>> >
>>>> > When loop on the symbols. I found that at one loop, I get
>>>> >
>>>> > s->filename = "../../src/common/string.cpp"
>>>> > s->dirname = "D:\code\wxWidgets-2.8.12\build\msw"
>>>> >
>>>> > But too badly, the result
>>>> > s->fullname =
>>>> > "D:\code\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp"
>>>> >
>>>> > This is the reason about the issue, if the result is:
>>>> > "D:\code\wxWidgets-2.8.12/src/common/string.cpp"
>>>> > Then, this problem can be fixed.
>>>> >
>>>> > I'm not sure why gdb does not give a cannical filename, but still
>>>> leaves
>>>> > the "../../" in the result.
>>>
>>> Because the function that canonicalizes the file name does not support
>>> backslashes correctly?
>>>
>>
>> By reading the gdb source, mostly in file: source.c and symtab.c
>>
>> char buf[MAX_PATH];
>> char* basename;
>> DWORD len = GetFullPathName (filename, MAX_PATH, buf, &basename);
>> ...
>From experience, I've found that using MAX_PATH*2 is useful. Its not
uncommon to have a few directories added to a user's temp directory
and exceed MAX_PATH. It will help keep you out of:
>> if (len == 0 || len > MAX_PATH - 1)
>> return strdup (filename);
>From experience, I've never encountered a valid case for MAX_PATH*3.
While possibly a valid length, I consider anything greater than
MAX_PATH*2 an attack.
>> [SNIP]
> Did you think we should add the "MS Windows method." in
> gdb\libiberty\lrealpath.c to the char * gdb_realpath (const char *filename)
> function body?
For what its worth, Microsoft has moved to the Consolidated URL Parser
(cURL) for path normalization and canonicalization. See, for example,
CreateUri Function [1] and ParseURL Function [2]. Howard and LeBlanc
recommend their use in Writing Secure Code for Windows Vista (pp.
130-131).
> As currently, it just do a strdup(filename) under MinGW32 (Windows).
Jeff
[1] http://msdn.microsoft.com/en-us/library/ms775098(v=vs.85).aspx
[2] http://msdn.microsoft.com/en-us/library/bb773825(v=vs.85).aspx
More information about the Gdb
mailing list