From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26551 invoked by alias); 5 Mar 2012 15:10:29 -0000 Received: (qmail 26541 invoked by uid 22791); 5 Mar 2012 15:10:27 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: sourceware.org Received: from mail-pw0-f41.google.com (HELO mail-pw0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Mar 2012 15:10:12 +0000 Received: by pbcup15 with SMTP id up15so249024pbc.0 for ; Mon, 05 Mar 2012 07:10:11 -0800 (PST) Received-SPF: pass (google.com: domain of asmwarrior@gmail.com designates 10.68.234.1 as permitted sender) client-ip=10.68.234.1; Authentication-Results: mr.google.com; spf=pass (google.com: domain of asmwarrior@gmail.com designates 10.68.234.1 as permitted sender) smtp.mail=asmwarrior@gmail.com; dkim=pass header.i=asmwarrior@gmail.com Received: from mr.google.com ([10.68.234.1]) by 10.68.234.1 with SMTP id ua1mr34185762pbc.69.1330960211995 (num_hops = 1); Mon, 05 Mar 2012 07:10:11 -0800 (PST) Received: by 10.68.234.1 with SMTP id ua1mr29564421pbc.69.1330960211858; Mon, 05 Mar 2012 07:10:11 -0800 (PST) Received: from [192.168.1.102] ([115.195.154.101]) by mx.google.com with ESMTPS id l8sm13568524pbi.0.2012.03.05.07.10.01 (version=SSLv3 cipher=OTHER); Mon, 05 Mar 2012 07:10:10 -0800 (PST) Message-ID: <4F54D758.8020508@gmail.com> Date: Mon, 05 Mar 2012 15:10:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: Chris Sutcliffe Subject: [windows] patch to set breakpoint in a dll Content-Type: multipart/mixed; boundary="------------000804080604090705050706" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00138.txt.bz2 This is a multi-part message in MIME format. --------------000804080604090705050706 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2197 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. Yuanhui Zhang Codeblocks forum ID(ollydbg) --------------000804080604090705050706 Content-Type: text/x-patch; name="dll_bp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dll_bp.patch" Content-length: 791 gdb/source.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/gdb/source.c b/gdb/source.c index cfdf81b..cd87e34 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -979,6 +979,7 @@ find_and_open_source (const char *filename, char *path = source_path; const char *p; int result; + char *lpath; /* Quick way out if we already know its full name. */ @@ -997,7 +998,12 @@ find_and_open_source (const char *filename, result = open (*fullname, OPEN_MODE); if (result >= 0) - return result; + { + lpath = gdb_realpath(*fullname); + xfree(*fullname); + *fullname = lpath; + return result; + } /* Didn't work -- free old one, try again. */ xfree (*fullname); *fullname = NULL; --------------000804080604090705050706--