public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* gdbtk-cmds.c: get a build error
@ 2010-03-12 14:19 Hui Zhu
  2010-03-12 17:17 ` [PATCH] Fix " Pierre Muller
  0 siblings, 1 reply; 6+ messages in thread
From: Hui Zhu @ 2010-03-12 14:19 UTC (permalink / raw)
  To: insight; +Cc: Keith Seitz

\" ../../src/gdb/gdbtk/generic/gdbtk-cmds.c
cc1: warnings being treated as errors
../../src/gdb/gdbtk/generic/gdbtk-cmds.c: In function 'gdb_listfiles':
../../src/gdb/gdbtk/generic/gdbtk-cmds.c:1148: warning: implicit
declaration of function 'ALL_PSYMTABS'
../../src/gdb/gdbtk/generic/gdbtk-cmds.c:1149: error: expected ';'
before '{' token
make[2]: *** [gdbtk-cmds.o] Error 1

My config is:
configure --disable-sid --disable-rda --disable-binutils --disable-gas
--disable-ld --disable-gprof --enable-targets=all --enable-64-bit-bfd

Thanks,
Hui

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

* [PATCH] Fix gdbtk-cmds.c: get a build error
  2010-03-12 14:19 gdbtk-cmds.c: get a build error Hui Zhu
@ 2010-03-12 17:17 ` Pierre Muller
  2010-03-12 18:28   ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2010-03-12 17:17 UTC (permalink / raw)
  To: 'Hui Zhu', insight; +Cc: 'Keith Seitz'



> -----Message d'origine-----
> De : insight-owner@sourceware.org [mailto:insight-owner@sourceware.org]
> De la part de Hui Zhu
> Envoyé : Thursday, March 11, 2010 8:01 AM
> À : insight@sourceware.org
> Cc : Keith Seitz
> Objet : gdbtk-cmds.c: get a build error
> 
> \" ../../src/gdb/gdbtk/generic/gdbtk-cmds.c
> cc1: warnings being treated as errors
> ../../src/gdb/gdbtk/generic/gdbtk-cmds.c: In function 'gdb_listfiles':
> ../../src/gdb/gdbtk/generic/gdbtk-cmds.c:1148: warning: implicit
> declaration of function 'ALL_PSYMTABS'
> ../../src/gdb/gdbtk/generic/gdbtk-cmds.c:1149: error: expected ';'
> before '{' token
> make[2]: *** [gdbtk-cmds.o] Error 1
This is because ALL_PSYMTAB
is now in psympriv.h header.

The patch below fixes it.
Checked in as obvious,


gdb/gdbtk ChangeLog entry:

2010-03-12  Pierre Muller  <muller@ics.u-strasbg.fr>

        * generic/gdbtk-cmds.c: Include psympriv.h.

Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.115
diff -u -p -r1.115 gdbtk-cmds.c
--- generic/gdbtk-cmds.c        25 Jan 2010 19:59:29 -0000      1.115
+++ generic/gdbtk-cmds.c        12 Mar 2010 14:14:03 -0000
@@ -27,6 +27,7 @@
 #include "inferior.h"
 #include "source.h"
 #include "symfile.h"
+#include "psympriv.h"
 #include "objfiles.h"
 #include "gdbcore.h"
 #include "demangle.h"

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

* Re: [PATCH] Fix gdbtk-cmds.c: get a build error
  2010-03-12 17:17 ` [PATCH] Fix " Pierre Muller
@ 2010-03-12 18:28   ` Tom Tromey
  2010-03-12 18:32     ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2010-03-12 18:28 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Hui Zhu', insight, 'Keith Seitz'

>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:

Pierre> The patch below fixes it.
Pierre> Checked in as obvious,

This patch isn't correct.

It will work for the time being, but it will break whenever we merge in
code that causes an objfile not to use psymtabs.

The rule is, only the psymtab implementation and debuginfo readers are
allowed to include psympriv.h.  All other code must go through the
"quick" API.

I'm working on a replacement patch.

Tom

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

* Re: [PATCH] Fix gdbtk-cmds.c: get a build error
  2010-03-12 18:28   ` Tom Tromey
@ 2010-03-12 18:32     ` Tom Tromey
  2010-03-15  2:20       ` Keith Seitz
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2010-03-12 18:32 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Hui Zhu', insight, 'Keith Seitz'

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> I'm working on a replacement patch.

Here it is.

Ok?

Tom

2010-03-12  Tom Tromey  <tromey@redhat.com>

	* generic/gdbtk-cmds.c: Include psymtab.h, not psympriv.h.
	(struct listfiles_info): New.
	(do_listfiles): New function.
	(gdb_listfiles): Use it.

Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.116
diff -u -r1.116 gdbtk-cmds.c
--- generic/gdbtk-cmds.c	12 Mar 2010 14:19:13 -0000	1.116
+++ generic/gdbtk-cmds.c	12 Mar 2010 18:26:21 -0000
@@ -27,7 +27,6 @@
 #include "inferior.h"
 #include "source.h"
 #include "symfile.h"
-#include "psympriv.h"
 #include "objfiles.h"
 #include "gdbcore.h"
 #include "demangle.h"
@@ -47,6 +46,7 @@
 #include "valprint.h"
 #include "regcache.h"
 #include "arch-utils.h"
+#include "psymtab.h"
 
 /* tcl header files includes varargs.h unless HAS_STDARG is defined,
    but gdb uses stdarg.h, so make sure HAS_STDARG is defined.  */
@@ -1104,6 +1104,42 @@
   return TCL_OK;
 }
 
+/* An object of this type is passed to do_listfiles.  */
+
+struct listfiles_info
+{
+  int *numfilesp;
+  int *files_sizep;
+  const char ***filesp;
+  int len;
+  const char *pathname;
+};
+
+/* This is a helper function for gdb_listfiles that is used via
+   map_partial_symbol_filenames.  */
+
+static void
+do_listfiles (const char *filename, const char *fullname, void *data)
+{
+  struct listfiles_info *info = data;
+
+  if (*info->numfilesp == *info->files_sizep)
+    {
+      *info->files_sizep *= 2;
+      *info->filesp = xrealloc (*info->filesp,
+				*info->files_sizep * sizeof (char *));
+    }
+
+  if (filename)
+    {
+      if (!info->len || !strncmp (info->pathname, filename, info->len)
+	  || !strcmp (filename, lbasename (filename)))
+	{
+	  (*info->filesp)[(*info->numfilesp)++] = lbasename (filename);
+	}
+    }
+}
+
 /* This implements the tcl command "gdb_listfiles"
 
 * This lists all the files in the current executible.
@@ -1134,6 +1170,7 @@
   const char **files;
   int files_size;
   int i, numfiles = 0, len = 0;
+  struct listfiles_info info;
 
   files_size = 1000;
   files = (const char **) xmalloc (sizeof (char *) * files_size);
@@ -1146,22 +1183,12 @@
   else if (objc == 2)
     pathname = Tcl_GetStringFromObj (objv[1], &len);
 
-  ALL_PSYMTABS (objfile, psymtab)
-    {
-      if (numfiles == files_size)
-	{
-	  files_size = files_size * 2;
-	  files = (const char **) xrealloc (files, sizeof (char *) * files_size);
-	}
-      if (psymtab->filename)
-	{
-	  if (!len || !strncmp (pathname, psymtab->filename, len)
-	      || !strcmp (psymtab->filename, lbasename (psymtab->filename)))
-	    {
-	      files[numfiles++] = lbasename (psymtab->filename);
-	    }
-	}
-    }
+  info.numfilesp = &numfiles;
+  info.files_sizep = &files_size;
+  info.filesp = &files;
+  info.len = len;
+  info.pathname = pathname;
+  map_partial_symbol_filenames (do_listfiles, &info);
 
   ALL_SYMTABS (objfile, symtab)
     {

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

* Re: [PATCH] Fix gdbtk-cmds.c: get a build error
  2010-03-12 18:32     ` Tom Tromey
@ 2010-03-15  2:20       ` Keith Seitz
  2010-03-17  5:44         ` Hui Zhu
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Seitz @ 2010-03-15  2:20 UTC (permalink / raw)
  To: Tom Tromey; +Cc: insight

On 03/12/2010 10:27 AM, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey<tromey@redhat.com>  writes:
>
> Tom>  I'm working on a replacement patch.
>
> Here it is.
>
> Ok?

Definitely a lot more like I was thinking it should look like.

Thank you for doing this, Tom. Please check it in.

Keith

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

* Re: [PATCH] Fix gdbtk-cmds.c: get a build error
  2010-03-15  2:20       ` Keith Seitz
@ 2010-03-17  5:44         ` Hui Zhu
  0 siblings, 0 replies; 6+ messages in thread
From: Hui Zhu @ 2010-03-17  5:44 UTC (permalink / raw)
  To: Keith Seitz, Tom Tromey, Pierre Muller; +Cc: insight

My insight is OK now.  Thanks guys.

Hui

On Sat, Mar 13, 2010 at 02:32, Keith Seitz <keiths@redhat.com> wrote:
> On 03/12/2010 10:27 AM, Tom Tromey wrote:
>>>>>>>
>>>>>>> "Tom" == Tom Tromey<tromey@redhat.com>  writes:
>>
>> Tom>  I'm working on a replacement patch.
>>
>> Here it is.
>>
>> Ok?
>
> Definitely a lot more like I was thinking it should look like.
>
> Thank you for doing this, Tom. Please check it in.
>
> Keith
>

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

end of thread, other threads:[~2010-03-15  2:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-12 14:19 gdbtk-cmds.c: get a build error Hui Zhu
2010-03-12 17:17 ` [PATCH] Fix " Pierre Muller
2010-03-12 18:28   ` Tom Tromey
2010-03-12 18:32     ` Tom Tromey
2010-03-15  2:20       ` Keith Seitz
2010-03-17  5:44         ` Hui Zhu

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