public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [patch] updates gdbtk to use lbasename() do to shared lib header tweaks.
@ 2005-05-26 23:09 Paul Schlie
  2005-05-27  1:31 ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Schlie @ 2005-05-26 23:09 UTC (permalink / raw)
  To: insight, Keith Seitz

[-- Attachment #1: Type: text/plain, Size: 85 bytes --]

(patch enclosed as an attachment, so don't know if it's visible on boards)

-paul-



[-- Attachment #2: gdbtk.patch --]
[-- Type: text/plain, Size: 3152 bytes --]

2005-05-26  Paul Schlie   <schlie@comcast.net>

        * gdb/gdbtk/generic/gdbtk-bp.c, gdb/gdbtk/generic/gdbtk-cmds.c
        update to use lbasename() in lieu of basename() as the remaining
        of binutils and gdb sources do to avoid the link time error:
        "_basename_cannot_be_used_without_a_prototype" otherwise resulting
        for targets which may not support the basename() function call.


Index: gdb/gdbtk/generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.24
diff -c -3 -p -r1.24 gdbtk-bp.c
*** gdb/gdbtk/generic/gdbtk-bp.c        2 Jul 2004 22:00:56 -0000       1.24
--- gdb/gdbtk/generic/gdbtk-bp.c        26 May 2005 22:31:04 -0000
*************** gdb_set_bp (ClientData clientData, Tcl_I
*** 535,541 ****
    b->thread = thread;
  
    /* FIXME: this won't work for duplicate basenames! */
!   xasprintf (&buf, "%s:%d", basename (Tcl_GetStringFromObj (objv[1], NULL)),
             line);
    b->addr_string = xstrdup (buf);
    free(buf);
--- 535,541 ----
    b->thread = thread;
  
    /* FIXME: this won't work for duplicate basenames! */
!   xasprintf (&buf, "%s:%d", lbasename (Tcl_GetStringFromObj (objv[1], NULL)),
             line);
    b->addr_string = xstrdup (buf);
    free(buf);
Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.88
diff -c -3 -p -r1.88 gdbtk-cmds.c
*** gdb/gdbtk/generic/gdbtk-cmds.c      17 Feb 2005 07:15:50 -0000      1.88
--- gdb/gdbtk/generic/gdbtk-cmds.c      26 May 2005 22:31:07 -0000
*************** gdb_listfiles (ClientData clientData, Tc
*** 1145,1153 ****
        if (psymtab->filename)
        {
          if (!len || !strncmp (pathname, psymtab->filename, len)
!             || !strcmp (psymtab->filename, basename (psymtab->filename)))
            {
!             files[numfiles++] = basename (psymtab->filename);
            }
        }
      }
--- 1145,1153 ----
        if (psymtab->filename)
        {
          if (!len || !strncmp (pathname, psymtab->filename, len)
!             || !strcmp (psymtab->filename, lbasename (psymtab->filename)))
            {
!             files[numfiles++] = lbasename (psymtab->filename);
            }
        }
      }
*************** gdb_listfiles (ClientData clientData, Tc
*** 1162,1170 ****
        if (symtab->filename && symtab->linetable && symtab->linetable->nitems)
        {
          if (!len || !strncmp (pathname, symtab->filename, len)
!             || !strcmp (symtab->filename, basename (symtab->filename)))
            {
!             files[numfiles++] = basename (symtab->filename);
            }
        }
      }
--- 1162,1170 ----
        if (symtab->filename && symtab->linetable && symtab->linetable->nitems)
        {
          if (!len || !strncmp (pathname, symtab->filename, len)
!             || !strcmp (symtab->filename, lbasename (symtab->filename)))
            {
!             files[numfiles++] = lbasename (symtab->filename);
            }
        }
      }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] updates gdbtk to use lbasename() do to shared lib header tweaks.
  2005-05-26 23:09 [patch] updates gdbtk to use lbasename() do to shared lib header tweaks Paul Schlie
@ 2005-05-27  1:31 ` Keith Seitz
  2005-05-27  4:48   ` Paul Schlie
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2005-05-27  1:31 UTC (permalink / raw)
  To: Paul Schlie; +Cc: insight

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

On Thu, 2005-05-26 at 19:09 -0400, Paul Schlie wrote:
> (patch enclosed as an attachment, so don't know if it's visible on boards)

Hmm. For some reason, I could not apply your patch. Goofy. Fortunately,
it was simple enough.

I have also take the opportunity to remove a few other compiler warnings
stemming from some gdb "API" changes from char* to gdb_byte*.

I tried to run this through the testsuite, but I see that varobj.c is
throwing an internal error trying to run c_variable.exp. :-(

I've attached the patch I committed.

Thanks,
Keith

ChangeLog
2005-05-26  Keith Seitz  <keiths@redhat.com>

        * generic/gdbtk-cmds.c (gdb_set_mem): target_write_memory now takes
        gdb_byte* instead of char*.
        * generic/gdbtk-register.c (get_register): frame_register and val_print
        take gdb_byte* instead of char*.
        * generic/gdbtk-wrapper.c: Ditto the val_print part.

        From Paul Schlie  <schlie@comcast.net>:
        * generic/gdbtk-bp.c (gdb_set_bp): Use lbasename instead of basename.
        * generic/gdbtk-cmds.c (gdb_listfiles): Likewise.



[-- Attachment #2: gdbtk.patch --]
[-- Type: text/x-patch, Size: 4938 bytes --]

Index: generic/gdbtk-bp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-bp.c,v
retrieving revision 1.24
diff -u -p -r1.24 gdbtk-bp.c
--- generic/gdbtk-bp.c	2 Jul 2004 22:00:56 -0000	1.24
+++ generic/gdbtk-bp.c	27 May 2005 01:21:29 -0000
@@ -535,7 +535,7 @@ gdb_set_bp (ClientData clientData, Tcl_I
   b->thread = thread;
 
   /* FIXME: this won't work for duplicate basenames! */
-  xasprintf (&buf, "%s:%d", basename (Tcl_GetStringFromObj (objv[1], NULL)),
+  xasprintf (&buf, "%s:%d", lbasename (Tcl_GetStringFromObj (objv[1], NULL)),
 	     line);
   b->addr_string = xstrdup (buf);
   free(buf);
Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.88
diff -u -p -r1.88 gdbtk-cmds.c
--- generic/gdbtk-cmds.c	17 Feb 2005 07:15:50 -0000	1.88
+++ generic/gdbtk-cmds.c	27 May 2005 01:21:30 -0000
@@ -1120,12 +1120,13 @@ gdb_listfiles (ClientData clientData, Tc
   struct objfile *objfile;
   struct partial_symtab *psymtab;
   struct symtab *symtab;
-  char *lastfile, *pathname = NULL, **files;
+  const char *lastfile, *pathname = NULL;
+  const char **files;
   int files_size;
   int i, numfiles = 0, len = 0;
 
   files_size = 1000;
-  files = (char **) xmalloc (sizeof (char *) * files_size);
+  files = (const char **) xmalloc (sizeof (char *) * files_size);
 
   if (objc > 2)
     {
@@ -1140,14 +1141,14 @@ gdb_listfiles (ClientData clientData, Tc
       if (numfiles == files_size)
 	{
 	  files_size = files_size * 2;
-	  files = (char **) xrealloc (files, sizeof (char *) * files_size);
+	  files = (const char **) xrealloc (files, sizeof (char *) * files_size);
 	}
       if (psymtab->filename)
 	{
 	  if (!len || !strncmp (pathname, psymtab->filename, len)
-	      || !strcmp (psymtab->filename, basename (psymtab->filename)))
+	      || !strcmp (psymtab->filename, lbasename (psymtab->filename)))
 	    {
-	      files[numfiles++] = basename (psymtab->filename);
+	      files[numfiles++] = lbasename (psymtab->filename);
 	    }
 	}
     }
@@ -1157,14 +1158,14 @@ gdb_listfiles (ClientData clientData, Tc
       if (numfiles == files_size)
 	{
 	  files_size = files_size * 2;
-	  files = (char **) xrealloc (files, sizeof (char *) * files_size);
+	  files = (const char **) xrealloc (files, sizeof (char *) * files_size);
 	}
       if (symtab->filename && symtab->linetable && symtab->linetable->nitems)
 	{
 	  if (!len || !strncmp (pathname, symtab->filename, len)
-	      || !strcmp (symtab->filename, basename (symtab->filename)))
+	      || !strcmp (symtab->filename, lbasename (symtab->filename)))
 	    {
-	      files[numfiles++] = basename (symtab->filename);
+	      files[numfiles++] = lbasename (symtab->filename);
 	    }
 	}
     }
@@ -2278,7 +2279,7 @@ gdb_set_mem (ClientData clientData, Tcl_
 	     int objc, Tcl_Obj *CONST objv[])
 {
   CORE_ADDR addr;
-  char buf[128];
+  gdb_byte buf[128];
   char *hexstr;
   int len, size;
 
@@ -2303,7 +2304,7 @@ gdb_set_mem (ClientData clientData, Tcl_
   /* Convert hexstr to binary and write */
   if (hexstr[0] == '0' && hexstr[1] == 'x')
     hexstr += 2;
-  size = hex2bin (hexstr, buf, strlen (hexstr));
+  size = hex2bin (hexstr, (char *) buf, strlen (hexstr));
   if (size < 0)
     {
       /* Error in input */
Index: generic/gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.27
diff -u -p -r1.27 gdbtk-register.c
--- generic/gdbtk-register.c	31 Oct 2004 10:05:09 -0000	1.27
+++ generic/gdbtk-register.c	27 May 2005 01:21:30 -0000
@@ -265,7 +265,7 @@ get_register (int regnum, void *arg)
   CORE_ADDR addr;
   enum lval_type lval;
   struct type *reg_vtype;
-  char buffer[MAX_REGISTER_SIZE];
+  gdb_byte buffer[MAX_REGISTER_SIZE];
   int optim, format;
   struct cleanup *old_chain = NULL;
   struct ui_file *stb;
Index: generic/gdbtk-wrapper.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-wrapper.c,v
retrieving revision 1.11
diff -u -p -r1.11 gdbtk-wrapper.c
--- generic/gdbtk-wrapper.c	18 Jan 2005 00:14:39 -0000	1.11
+++ generic/gdbtk-wrapper.c	27 May 2005 01:21:30 -0000
@@ -192,7 +192,7 @@ wrap_val_print (char *a)
 {
   struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a;
   struct type *type;
-  char *valaddr;
+  const gdb_byte *valaddr;
   CORE_ADDR address;
   struct ui_file *stream;
   int format;
@@ -201,7 +201,7 @@ wrap_val_print (char *a)
   enum val_prettyprint pretty;
 
   type = (struct type *) (*args)->args[0];
-  valaddr = (char *) (*args)->args[1];
+  valaddr = (gdb_byte *) (*args)->args[1];
   address = *(CORE_ADDR *) (*args)->args[2];
   stream = (struct ui_file *) (*args)->args[3];
   format = (int) (*args)->args[4];

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] updates gdbtk to use lbasename() do to shared lib header tweaks.
  2005-05-27  1:31 ` Keith Seitz
@ 2005-05-27  4:48   ` Paul Schlie
  2005-05-27  6:07     ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Schlie @ 2005-05-27  4:48 UTC (permalink / raw)
  To: Keith Seitz; +Cc: insight

> From: Keith Seitz <keiths@redhat.com>
>> On Thu, 2005-05-26 at 19:09 -0400, Paul Schlie wrote:
>> (patch enclosed as an attachment, so don't know if it's visible on boards)
> 
> Hmm. For some reason, I could not apply your patch. Goofy. Fortunately,
> it was simple enough.
> 
> I have also take the opportunity to remove a few other compiler warnings
> stemming from some gdb "API" changes from char* to gdb_byte*.
> 
> I tried to run this through the testsuite, but I see that varobj.c is
> throwing an internal error trying to run c_variable.exp. :-(

Thank you. With respect to the test-suite failure, I'm embarrassed to admit
that I've never actually run it, as for some reason which I haven't looked
close enough to know why, it's not being built by default when I configure
and build the entire source tree (so correspondingly have never run it),
but things seem to be ok (but haven't applied your latest tweaks yet
which should only help), but suspect its possible something subtle is
wrong that the test-suite is catching that I haven't seen or noticed?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] updates gdbtk to use lbasename() do to shared lib header tweaks.
  2005-05-27  4:48   ` Paul Schlie
@ 2005-05-27  6:07     ` Keith Seitz
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Seitz @ 2005-05-27  6:07 UTC (permalink / raw)
  To: Paul Schlie; +Cc: insight

On Fri, 2005-05-27 at 00:47 -0400, Paul Schlie wrote:
K
> Thank you. With respect to the test-suite failure, I'm embarrassed to admit
> that I've never actually run it, as for some reason which I haven't looked
> close enough to know why, it's not being built by default when I configure
> and build the entire source tree (so correspondingly have never run it),
> but things seem to be ok (but haven't applied your latest tweaks yet
> which should only help), but suspect its possible something subtle is
> wrong that the test-suite is catching that I haven't seen or noticed?

Don't worry too much about the testsuite: it's still largely incomplete.
Most of the problems crop up in c_variable or cpp_variable, but most of
these failures are problems with gdb.

FWIW, the last time I tweaked the testsuite, I wrote quite a thesis
about it in src/gdb/testsuite/gdb.gdbtk/README.

It works on both unix(en) and cygwin. For unix(en) hosts, I recommend
having Xvfb installed -- the README will explain a lot more about that
than I could possibly hope to convey at this time.

Zzzzz, 
Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-27  6:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-26 23:09 [patch] updates gdbtk to use lbasename() do to shared lib header tweaks Paul Schlie
2005-05-27  1:31 ` Keith Seitz
2005-05-27  4:48   ` Paul Schlie
2005-05-27  6:07     ` Keith Seitz

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).