public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: asmwarrior <asmwarrior@gmail.com>
To: gdb@sourceware.org,
	 MinGW Users List <mingw-users@lists.sourceforge.net>
Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue[solved with a patch]
Date: Tue, 14 Jun 2011 05:27:00 -0000	[thread overview]
Message-ID: <4DF6F051.6040009@gmail.com> (raw)
In-Reply-To: <83ips9acr7.fsf@gnu.org>

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

      parent reply	other threads:[~2011-06-14  5:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11  7:49 setting a breakpoint on a dll, relative path or absolute path issue 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
2011-06-14  5:27         ` asmwarrior [this message]

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=4DF6F051.6040009@gmail.com \
    --to=asmwarrior@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=mingw-users@lists.sourceforge.net \
    /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).