From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32272 invoked by alias); 14 Jun 2011 05:27:23 -0000 Received: (qmail 32262 invoked by uid 22791); 14 Jun 2011 05:27:21 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_DB,TW_RG X-Spam-Check-By: sourceware.org Received: from mail-px0-f182.google.com (HELO mail-px0-f182.google.com) (209.85.212.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Jun 2011 05:27:06 +0000 Received: by pxi20 with SMTP id 20so3226056pxi.13 for ; Mon, 13 Jun 2011 22:27:05 -0700 (PDT) Received: by 10.142.221.17 with SMTP id t17mr1013630wfg.256.1308029225834; Mon, 13 Jun 2011 22:27:05 -0700 (PDT) Received: from [210.32.139.52] ([210.32.139.52]) by mx.google.com with ESMTPS id x16sm6738301wfc.10.2011.06.13.22.27.02 (version=SSLv3 cipher=OTHER); Mon, 13 Jun 2011 22:27:04 -0700 (PDT) Message-ID: <4DF6F051.6040009@gmail.com> Date: Tue, 14 Jun 2011 05:27:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: gdb@sourceware.org, MinGW Users List Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue[solved with a patch] References: <4DF31EB0.6080006@gmail.com> <4DF37ADA.3070905@users.sourceforge.net> <4DF4513A.3090902__7466.60719528354$1307866544$gmane$org@gmail.com> <4DF5AE48.9050202@gmail.com> <83ips9acr7.fsf@gnu.org> In-Reply-To: <83ips9acr7.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00102.txt.bz2 Sounds like I have fix this problem by using the patches below. (I'm sorry I'm only a beginner of git, so correct me if I'm wrong) gdb/linespec.c | 3 ++- gdb/source.c | 48 +++++++++++++++++++++++++++--------------------- gdb/utils.c | 24 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 22 deletions(-) diff --git a/gdb/linespec.c b/gdb/linespec.c index c820539..c8251c5 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1211,7 +1211,8 @@ locate_first_half (char **argptr, int *is_quote_enclosed) quotes we do not break on enclosed spaces. */ if (!*p || p[0] == '\t' - || (p[0] == ':') + || ((p[0] == ':') + && ((p[1] == ':') || (strchr (p + 1, ':') == NULL))) || ((p[0] == ' ') && !*is_quote_enclosed)) break; if (p[0] == '.' && strchr (p, ':') == NULL) diff --git a/gdb/source.c b/gdb/source.c index 70890e1..77dc249 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -149,7 +149,7 @@ get_lines_to_list (void) /* Return the current source file for listing and next line to list. NOTE: The returned sal pc and end fields are not valid. */ - + struct symtab_and_line get_current_source_symtab_and_line (void) { @@ -160,7 +160,7 @@ get_current_source_symtab_and_line (void) cursal.line = current_source_line; cursal.pc = 0; cursal.end = 0; - + return cursal; } @@ -171,7 +171,7 @@ get_current_source_symtab_and_line (void) process of determining a new default may call the caller! Use get_current_source_symtab_and_line only to get whatever we have without erroring out or trying to get a default. */ - + void set_default_source_symtab_and_line (void) { @@ -187,7 +187,7 @@ set_default_source_symtab_and_line (void) (the returned sal pc and end fields are not valid.) and set the current default to whatever is in SAL. NOTE: The returned sal pc and end fields are not valid. */ - + struct symtab_and_line set_current_source_symtab_and_line (const struct symtab_and_line *sal) { @@ -702,7 +702,7 @@ is_regular_file (const char *name) the actual file opened (this string will always start with a "/"). We have to take special pains to avoid doubling the "/" between the directory and the file, sigh! Emacs gets confuzzed by this when we print the - source file name!!! + source file name!!! If a file is found, return the descriptor. Otherwise, return -1, with errno set for the last name we tried to open. */ @@ -924,7 +924,7 @@ substitute_path_rule_matches (const struct substitute_path_rule *rule, /* Make sure that the region in the path that matches the substitution rule is immediately followed by a directory separator (or the end of string character). */ - + if (path[from_len] != '\0' && !IS_DIR_SEPARATOR (path[from_len])) return 0; @@ -948,17 +948,17 @@ get_substitute_path_rule (const char *path) /* If the user specified a source path substitution rule that applies to PATH, then apply it and return the new path. This new path must be deallocated afterwards. - + Return NULL if no substitution rule was specified by the user, or if no rule applied to the given PATH. */ - + static char * rewrite_source_path (const char *path) { const struct substitute_path_rule *rule = get_substitute_path_rule (path); char *new_path; int from_len; - + if (rule == NULL) return NULL; @@ -985,7 +985,7 @@ rewrite_source_path (const char *path) Space for the path must have been malloc'd. If a path substitution is applied we free the old value and set a new one. - On Success + On Success A valid file descriptor is returned (the return value is positive). FULLNAME is set to the absolute path to the file just opened. The caller is responsible for freeing FULLNAME. @@ -1002,6 +1002,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. */ @@ -1010,7 +1011,7 @@ find_and_open_source (const char *filename, /* 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); + char *rewritten_fullname = rewrite_source_path (*fullname); if (rewritten_fullname != NULL) { @@ -1020,7 +1021,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; @@ -1038,7 +1044,7 @@ find_and_open_source (const char *filename, make_cleanup (xfree, rewritten_dirname); dirname = rewritten_dirname; } - + /* Replace a path entry of $cdir with the compilation directory name. */ #define cdir_len 5 @@ -1072,7 +1078,7 @@ find_and_open_source (const char *filename, filename = rewritten_filename; } } - + result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, fullname); if (result < 0) { @@ -1086,8 +1092,8 @@ find_and_open_source (const char *filename, } /* Open a source file given a symtab S. Returns a file descriptor or - negative number for error. - + negative number for error. + This function is a convience function to find_and_open_source. */ int @@ -1159,7 +1165,7 @@ find_source_lines (struct symtab *s, int desc) { struct cleanup *old_cleanups; - /* st_size might be a large type, but we only support source files whose + /* st_size might be a large type, but we only support source files whose size fits in an int. */ size = (int) st.st_size; @@ -1773,7 +1779,7 @@ show_substitute_path_command (char *args, int from_tty) struct substitute_path_rule *rule = substitute_path_rules; char **argv; char *from = NULL; - + argv = gdb_buildargv (args); make_cleanup_freeargv (argv); @@ -1843,7 +1849,7 @@ unset_substitute_path_command (char *args, int from_tty) rule = next; } - + /* If the user asked for a specific rule to be deleted but we could not find it, then report an error. */ @@ -1860,7 +1866,7 @@ set_substitute_path_command (char *args, int from_tty) { char **argv; struct substitute_path_rule *rule; - + argv = gdb_buildargv (args); make_cleanup_freeargv (argv); @@ -1884,7 +1890,7 @@ set_substitute_path_command (char *args, int from_tty) rule = find_substitute_path_rule (argv[0]); if (rule != NULL) delete_substitute_path_rule (rule); - + /* Insert the new substitution rule. */ add_substitute_path_rule (argv[0], argv[1]); diff --git a/gdb/utils.c b/gdb/utils.c index d10669a..14944da 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3442,6 +3442,30 @@ gdb_realpath (const char *filename) } #endif + /* The MS Windows method. If we don't have realpath, we assume we + don't have symlinks and just canonicalize to a Windows absolute + path. GetFullPath converts ../ and ./ in relative paths to + absolute paths, filling in current drive if one is not given + or using the current directory of a specified drive (eg, "E:foo"). + It also converts all forward slashes to back slashes. */ +#if defined (_WIN32) + { + char buf[MAX_PATH]; + char* basename; + DWORD len = GetFullPathName (filename, MAX_PATH, buf, &basename); + if (len == 0 || len > MAX_PATH - 1) + return xstrdup (filename); + else + { + /* The file system is case-preserving but case-insensitive, + Canonicalize to lowercase, using the codepage associated + with the process locale. */ + CharLowerBuff (buf, len); + return xstrdup (buf); + } + } +#endif + /* This system is a lost cause, just dup the buffer. */ return xstrdup (filename); } asmwarrior ollydbg from codeblocks' forum