public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: Asm warrior <asmwarrior@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue
Date: Tue, 14 Jun 2011 04:22:00 -0000	[thread overview]
Message-ID: <BANLkTik-85f-GMsVw2DQBLw260w5yDojgw@mail.gmail.com> (raw)
In-Reply-To: <4DF6D94A.7080408@gmail.com>

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

  reply	other threads:[~2011-06-14  4:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11  7:49 asmwarrior
2011-06-11 17:56 ` Keith Seitz
2011-06-12  3:56   ` asmwarrior
2011-06-12  7:45     ` asmwarrior
2011-06-12  7:56       ` Jan Kratochvil
2011-06-12  8:06         ` asmwarrior
2011-06-12 16:22           ` [Mingw-users] " Earnie
2011-06-12 16:51         ` Eli Zaretskii
2011-06-12 16:54           ` Jan Kratochvil
     [not found] ` <4DF37ADA.3070905@users.sourceforge.net>
2011-06-12  8:15   ` asmwarrior
     [not found]   ` <4DF4513A.3090902__7466.60719528354$1307866544$gmane$org@gmail.com>
2011-06-13  6:33     ` Asm warrior
2011-06-13 17:02       ` Eli Zaretskii
2011-06-14  3:14         ` Asm warrior
2011-06-14  3:49           ` Asm warrior
2011-06-14  4:22             ` Jeffrey Walton [this message]
2011-06-14  5:27         ` setting a breakpoint on a dll, relative path or absolute path issue[solved with a patch] asmwarrior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTik-85f-GMsVw2DQBLw260w5yDojgw@mail.gmail.com \
    --to=noloader@gmail.com \
    --cc=asmwarrior@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).