This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [windows] patch to set breakpoint in a dll


On 2012-3-15 2:26, Doug Evans wrote:
On Fri, Mar 9, 2012 at 8:40 PM, asmwarrior<asmwarrior@gmail.com> wrote:
On 2012-3-9 6:39, Doug Evans wrote:
No such quick check is available, but I think we can ignore the cost
of the xmalloc/xfree for this particular case until the data shows
it's a problem.
Ok, this is the modified patch.(simply replace gdb_fullpath with xfullpath)
It works Ok under mingw+windowsXP.
Thanks.
This needs a ChangeLog entry of course.
Something like

2012-03-14 Zhang Yuanhui<asmwarrior@gmail.com>

	* source.c (find_and_open_source): Consistently pass resulting
	full path through xfullpath.

Further comments inline with the patch.

   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;

Move this declaration into the block where it is used.

/* 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;
   +      {

Add a comment here explaining why we're calling xfullpath.
E.g.,
            /* Call xfullpath here to be consistent with openp
               which we use below.  */

   +        lpath = xfullpath(*fullname);
   +        xfree(*fullname);

Space before '('.
Plus, for consistency, I think the indentation here should use tabs.

   +        *fullname = lpath;
   +        return result;
   +      }
          /* Didn't work -- free old one, try again.  */
          xfree (*fullname);
          *fullname = NULL;


Ok with those changes. Thanks!
Ok, this is the new patch.(I have problem using the TortoiseGit to generate a diff between two revisions.you can see, the file name is long and dirty)

Also, the log message is what you wrote:


2012-03-14 Zhang Yuanhui <asmwarrior@gmail.com>


    * source.c (find_and_open_source): Consistently pass resulting
    full path through xfullpath.


My family name is "Zhang", so I'm not sure it should be put before the given name or after the given name. The Chinese name and English name have different formats.



Thanks.









diff --git "a/C:\\Temp\\sou4C.tmp\\source-765c91-left.c" "b/C:\\Temp\\sou49.tmp\\source-e835db-right.c"
index cfdf81b..1293b38 100644
--- "a/C:\\Temp\\sou4C.tmp\\source-765c91-left.c"
+++ "b/C:\\Temp\\sou49.tmp\\source-e835db-right.c"
@@ -996,8 +996,16 @@ find_and_open_source (const char *filename,
         }
 
       result = open (*fullname, OPEN_MODE);
+      /* Call xfullpath here to be consistent with openp
+         which we use below.  */
       if (result >= 0)
+      {
+	char *lpath;
+	lpath = xfullpath (*fullname);
+	xfree (*fullname);
+	*fullname = lpath;
 	return result;
+      }
       /* Didn't work -- free old one, try again.  */
       xfree (*fullname);
       *fullname = NULL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]