From: Doug Evans <dje@google.com>
To: asmwarrior <asmwarrior@gmail.com>
Cc: gdb-patches@sourceware.org, Chris Sutcliffe <ir0nh34d@gmail.com>
Subject: Re: [windows] patch to set breakpoint in a dll
Date: Wed, 07 Mar 2012 18:46:00 -0000 [thread overview]
Message-ID: <CADPb22Sy7P5fU9=H7P6sFQjhuGkTdwmAyuEq_fC1VQ1DsfGNNw@mail.gmail.com> (raw)
In-Reply-To: <4F54D758.8020508@gmail.com>
On Mon, Mar 5, 2012 at 7:10 AM, asmwarrior <asmwarrior@gmail.com> wrote:
> Hi, all. Several months ago, I have propose and discuss this issue, but now
> I see no progress, so I just give a "Ping" like post.
>
> The patch is quite simple. (see the attachment), currently, the patch is
> include in the MinGW's official gdb 7.4 release.
>
> Why we need this patch? It can let us debug dll(the dll is build with
> relative file path under GCC)
> The reason is below: this is my modified code
>
> int
> find_and_open_source (const char *filename,
> const char *dirname,
> char **fullname)
> {
> char *path = source_path;
> const char *p;
> int result;
> char *lpath;
>
> /* Quick way out if we already know its full name. */
>
> if (*fullname)
> {
> /* The user may have requested that source paths be rewritten
> according to substitution rules he provided. If a substitution
> rule applies to this path, then apply it. */
> char *rewritten_fullname = rewrite_source_path (*fullname);
>
> if (rewritten_fullname != NULL)
> {
> xfree (*fullname);
> *fullname = rewritten_fullname;
> }
>
> result = open (*fullname, OPEN_MODE);
> if (result >= 0)
> {
> lpath = gdb_realpath(*fullname);
> xfree(*fullname);
> *fullname = lpath;
> return result;
> }
> /* Didn't work -- free old one, try again. */
> xfree (*fullname);
> *fullname = NULL;
> }
>
> Here,
> the *fullname =
> E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp
>
> And you set the break point by using this command:
> break "E:/code/cb/wx/wxWidgets-2.8.12/src/common/string.cpp:164"
> Without the patch, GDB can not set the breakpoint, no file name matches.
>
> Luckily, the second break command works:
> break
> E:\code\cb\wx\wxWidgets-2.8.12\build\msw/../../src/common/string.cpp:164
> But I think no body will wrote such kind of file path specification.
>
>
> Now, In my patch, I add a function "gdb_realpath" which internally use
> Windows API GetFullPathName() to calculate the canonized path. So, with this
> patch, the first break command works.
>
> We have many discussion before:
> http://sourceware.org/ml/gdb/2011-06/msg00074.html
>
> Thanks.
The patch has a few nits that need to be fixed, but I like the idea:
have find_and_open_source consistently return the canonicalized path.
However, openp (called by find_and_open_source later on) uses
xfullpath, so for consistency I think that should be used here too
instead of gdb_realpath.
What do others think?
next prev parent reply other threads:[~2012-03-07 18:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 15:10 asmwarrior
2012-03-07 18:46 ` Doug Evans [this message]
2012-03-08 2:18 ` asmwarrior
2012-03-08 22:39 ` Doug Evans
2012-03-10 4:39 ` asmwarrior
2012-03-14 18:26 ` Doug Evans
2012-03-16 1:52 ` asmwarrior
2012-03-16 22:23 ` Doug Evans
2012-03-17 1:13 ` asmwarrior
2012-04-11 15:25 ` asmwarrior
2012-04-11 18:43 ` Doug Evans
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='CADPb22Sy7P5fU9=H7P6sFQjhuGkTdwmAyuEq_fC1VQ1DsfGNNw@mail.gmail.com' \
--to=dje@google.com \
--cc=asmwarrior@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=ir0nh34d@gmail.com \
/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