Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] catch syscall -- try 5 -- Introduction
@ 2009-04-23  0:33 Sérgio Durigan Júnior
  2009-04-23  1:18 ` Tom Tromey
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Sérgio Durigan Júnior @ 2009-04-23  0:33 UTC (permalink / raw)
  To: gdb-patches

Hello GDB hackers,

Here goes my fifth attempt to get this patch accepted :-). I believe
that everything will be fine this time, and the catch syscall feature
will finally appear in GDB 7!

Things that have changed since the last attempt:

- In the documentation part:

http://sourceware.org/ml/gdb-patches/2009-01/msg00492.html (from Eli)

http://sourceware.org/ml/gdb-patches/2009-02/msg00013.html (from Daniel)

- As for the XML support:

http://sourceware.org/ml/gdb-patches/2009-01/msg00495.html (from Pierre)

http://sourceware.org/ml/gdb-patches/2009-02/msg00012.html (from Daniel)

- Regarding the source-code:

http://sourceware.org/ml/gdb-patches/2009-01/msg00489.html (from Pedro)

http://sourceware.org/ml/gdb-patches/2009-02/msg00010.html (from Daniel)


There are other small comments that I have addressed while doing this,
and other replies to the comments above that I didn't paste. Please, let
me know if something is wrong/missing.

There's one thing worth mentioning: this patch implements the command
"maint set data-directory", which is already implemented by one of
Tromey's pretty-printing patches. If Tromey's patches are accepted
first, then I can (need) modify my patch in order to use his version of
the command

Regards,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23  0:33 [PATCH 0/3] catch syscall -- try 5 -- Introduction Sérgio Durigan Júnior
@ 2009-04-23  1:18 ` Tom Tromey
  2009-04-23  2:29   ` Sérgio Durigan Júnior
  2009-04-23 11:49 ` Hui Zhu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2009-04-23  1:18 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb-patches

>>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:

Sérgio> There's one thing worth mentioning: this patch implements the
Sérgio> command "maint set data-directory", which is already
Sérgio> implemented by one of Tromey's pretty-printing patches. If
Sérgio> Tromey's patches are accepted first, then I can (need) modify
Sérgio> my patch in order to use his version of the command

I can push this particular one in any time.  If I remember, I'll do it
tomorrow -- or ping on me on irc.

It is really only the MI patch that is waiting.  I thought it would be
good for Vladimir to look at the new MI commands before I put it in.
I could actually put in all the earlier patches immediately; I will do
that barring objection.

Tom


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23  1:18 ` Tom Tromey
@ 2009-04-23  2:29   ` Sérgio Durigan Júnior
  2009-04-23 18:23     ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Sérgio Durigan Júnior @ 2009-04-23  2:29 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches

Hi Tom,

On Wed, 2009-04-22 at 19:18 -0600, Tom Tromey wrote:
> >>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:
> 
> Sérgio> There's one thing worth mentioning: this patch implements the
> Sérgio> command "maint set data-directory", which is already
> Sérgio> implemented by one of Tromey's pretty-printing patches. If
> Sérgio> Tromey's patches are accepted first, then I can (need) modify
> Sérgio> my patch in order to use his version of the command
> 
> I can push this particular one in any time.  If I remember, I'll do it
> tomorrow -- or ping on me on irc.

I ping'ed you about two days ago about it, and you told that it was my
decision to send or not this part of the patch, so that's why I sent.
I'd obviously prefer to have my version of the patch commited, since my
testcase is based on it; however, it isn't hard for me to change things
in order to reflect your patch. Please, let me know when you have
commited it so I can make the needed changes and resubmit. I'll ping you
tomorrow about it if I remember :-).

Thank you!

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23  0:33 [PATCH 0/3] catch syscall -- try 5 -- Introduction Sérgio Durigan Júnior
  2009-04-23  1:18 ` Tom Tromey
@ 2009-04-23 11:49 ` Hui Zhu
  2009-04-23 15:16   ` Sérgio Durigan Júnior
  2009-05-07  3:22 ` Hui Zhu
  2009-05-17 20:43 ` Sérgio Durigan Júnior
  3 siblings, 1 reply; 16+ messages in thread
From: Hui Zhu @ 2009-04-23 11:49 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb-patches

I got:

gcc -g -O2      \
		-o gdb gdb.o libgdb.a \
		   ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a
 ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lncurses
-lm     -lpython2.5  ../libiberty/libiberty.a  gnulib/libgnu.a -ldl
-rdynamic
libgdb.a(i386-linux-tdep.o): In function `i386_linux_init_abi':
/home/teawater/gdb/bgdb/gdb/../../src/gdb/i386-linux-tdep.c:499:
undefined reference to `set_xml_syscall_file_name'
libgdb.a(breakpoint.o): In function `catch_syscall_completer':
/home/teawater/gdb/bgdb/gdb/../../src/gdb/breakpoint.c:8664: undefined
reference to `get_syscall_names'
libgdb.a(breakpoint.o): In function `print_it_catch_syscall':
/home/teawater/gdb/bgdb/gdb/../../src/gdb/breakpoint.c:4940: undefined
reference to `get_syscall_by_number'
libgdb.a(breakpoint.o): In function `print_mention_catch_syscall':
/home/teawater/gdb/bgdb/gdb/../../src/gdb/breakpoint.c:5025: undefined
reference to `get_syscall_by_number'
libgdb.a(breakpoint.o): In function `print_one_catch_syscall':
/home/teawater/gdb/bgdb/gdb/../../src/gdb/breakpoint.c:4989: undefined
reference to `get_syscall_by_number'
libgdb.a(breakpoint.o): In function `catch_syscall_command_1':
/home/teawater/gdb/bgdb/gdb/../../src/gdb/breakpoint.c:7219: undefined
reference to `get_syscall_by_number'
libgdb.a(breakpoint.o): In function `catch_syscall_split_args':
/home/teawater/gdb/bgdb/gdb/../../src/gdb/breakpoint.c:7166: undefined
reference to `get_syscall_by_number'
/home/teawater/gdb/bgdb/gdb/../../src/gdb/breakpoint.c:7180: undefined
reference to `get_syscall_by_name'
collect2: ld returned 1 exit status
make[2]: *** [gdb] Error 1


I386-linux ubuntu.


Thanks,
Hui


2009/4/23 Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com>:
> Hello GDB hackers,
>
> Here goes my fifth attempt to get this patch accepted :-). I believe
> that everything will be fine this time, and the catch syscall feature
> will finally appear in GDB 7!
>
> Things that have changed since the last attempt:
>
> - In the documentation part:
>
> http://sourceware.org/ml/gdb-patches/2009-01/msg00492.html (from Eli)
>
> http://sourceware.org/ml/gdb-patches/2009-02/msg00013.html (from Daniel)
>
> - As for the XML support:
>
> http://sourceware.org/ml/gdb-patches/2009-01/msg00495.html (from Pierre)
>
> http://sourceware.org/ml/gdb-patches/2009-02/msg00012.html (from Daniel)
>
> - Regarding the source-code:
>
> http://sourceware.org/ml/gdb-patches/2009-01/msg00489.html (from Pedro)
>
> http://sourceware.org/ml/gdb-patches/2009-02/msg00010.html (from Daniel)
>
>
> There are other small comments that I have addressed while doing this,
> and other replies to the comments above that I didn't paste. Please, let
> me know if something is wrong/missing.
>
> There's one thing worth mentioning: this patch implements the command
> "maint set data-directory", which is already implemented by one of
> Tromey's pretty-printing patches. If Tromey's patches are accepted
> first, then I can (need) modify my patch in order to use his version of
> the command
>
> Regards,
>
> --
> Sérgio Durigan Júnior
> Linux on Power Toolchain - Software Engineer
> Linux Technology Center - LTC
> IBM Brazil
>
>


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23 11:49 ` Hui Zhu
@ 2009-04-23 15:16   ` Sérgio Durigan Júnior
  2009-04-23 15:28     ` Hui Zhu
  0 siblings, 1 reply; 16+ messages in thread
From: Sérgio Durigan Júnior @ 2009-04-23 15:16 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches

Hi Hui,

On Thu, 2009-04-23 at 19:49 +0800, Hui Zhu wrote:
> I got:

You must apply all the 3 patches in order to compile and use the
feature.

Thanks,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23 15:16   ` Sérgio Durigan Júnior
@ 2009-04-23 15:28     ` Hui Zhu
  2009-04-23 15:52       ` Sérgio Durigan Júnior
  0 siblings, 1 reply; 16+ messages in thread
From: Hui Zhu @ 2009-04-23 15:28 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb-patches

I got it because:
#ifndef HAVE_LIBEXPAT

/* Dummy functions to indicate that there's no support for fetching
   syscalls information.  */

static void
syscall_warn_user (void)
{
  static int have_warned = 0;
  if (!have_warned)
    {
      have_warned = 1;
      warning (_("Can not parse XML syscalls information; XML support was "
		 "disabled at compile time."));
    }
}

const struct syscalls_info *
xml_init_syscalls_info (const char *filename)
{
  syscall_warn_user ();
  return NULL;
}

int
xml_get_syscall_number (const struct syscalls_info *sysinfo,
                        const char *syscall_name)
{
  syscall_warn_user ();
  return UNKNOWN_SYSCALL;
}

const char *
xml_get_syscall_name (const struct syscalls_info *sysinfo,
                      int syscall_number)
{
  syscall_warn_user ();
  return NULL;
}

int
xml_number_of_syscalls (const struct syscalls_info *sysinfo)
{
  syscall_warn_user ();
  return 0;
}

const char **
xml_list_of_syscalls (const struct syscalls_info *sysinfo)
{
  syscall_warn_user ();
  return NULL;
}

#else /* ! HAVE_LIBEXPAT */

That is why I got this error.  I don't have LIBEXPAT.  Are you sure I
got a error is a right way?


Thanks,
Hui




2009/4/23 Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com>:
> Hi Hui,
>
> On Thu, 2009-04-23 at 19:49 +0800, Hui Zhu wrote:
>> I got:
>
> You must apply all the 3 patches in order to compile and use the
> feature.
>
> Thanks,
>
> --
> Sérgio Durigan Júnior
> Linux on Power Toolchain - Software Engineer
> Linux Technology Center - LTC
> IBM Brazil
>
>


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23 15:28     ` Hui Zhu
@ 2009-04-23 15:52       ` Sérgio Durigan Júnior
  0 siblings, 0 replies; 16+ messages in thread
From: Sérgio Durigan Júnior @ 2009-04-23 15:52 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches

Hello Hui,

On Thu, 2009-04-23 at 23:27 +0800, Hui Zhu wrote:
> I got it because:
> #ifndef HAVE_LIBEXPAT

Now I see, there's an error in the code... I'll resubmit it ASAP.

Thanks,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23  2:29   ` Sérgio Durigan Júnior
@ 2009-04-23 18:23     ` Tom Tromey
  2009-04-23 21:27       ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2009-04-23 18:23 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb-patches

>>>>> "Sérgio" == Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com> writes:

Tom> I can push this particular one in any time.  If I remember, I'll do it
Tom> tomorrow -- or ping on me on irc.

Sérgio> I ping'ed you about two days ago about it, and you told that it was my
Sérgio> decision to send or not this part of the patch, so that's why I sent.

Yeah, I forgot the conclusion of that.  Sorry.

Sérgio> I'd obviously prefer to have my version of the patch commited,
Sérgio> since my testcase is based on it

I'll catch you on irc and we can decide.

Tom


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23 18:23     ` Tom Tromey
@ 2009-04-23 21:27       ` Tom Tromey
  2009-04-24 13:47         ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2009-04-23 21:27 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb-patches

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

Sérgio> I'd obviously prefer to have my version of the patch commited,
Sérgio> since my testcase is based on it

Tom> I'll catch you on irc and we can decide.

We discussed this on irc a bit, and agreed that I will commit my
version of the patch.  This version has the simplifications to how
relocatable directories are defined, and renames the command to "set
data-directory", per commentary on the list.

The patch needed a minor refresh to apply after the AS_HELP_STRING
changes.  The actual patch I'm committing is appended.

Tom

2009-04-23  Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com>
	    Tom Tromey  <tromey@redhat.com>

	* configure, config.in: Regenerate.
	* configure.ac: Support for relocatable GDB datadir.  Use
	GDB_AC_WITH_DIR.  Always define TARGET_SYSTEM_ROOT_RELOCATABLE.
	* acinclude.m4 (GDB_AC_WITH_DIR): New defun.
	* top.c (init_main): Add "set data-directory".
	* defs.h (gdb_datadir): Declare.
	* main.c (gdb_datadir): New global.
	(captured_main): Initialize gdb_datadir.  Use relocate_directory.
	(relocate_path): New function.
	(relocate_directory): Likewise.
	(get_init_files): Use relocate_path.
	(README): Mention --with-gdb-datadir.

2009-04-23  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Data Files): New node.
	(GDB Files): Update menu.

Index: README
===================================================================
RCS file: /cvs/src/src/gdb/README,v
retrieving revision 1.42
diff -u -r1.42 README
--- README	17 Jan 2008 20:18:48 -0000	1.42
+++ README	23 Apr 2009 21:17:44 -0000
@@ -436,6 +436,11 @@
      Same as `--host=HOST'.  If you omit this, GDB will guess; it's
      quite accurate.
 
+`--with-gdb-datadir=PATH'
+     Set the GDB-specific data directory.  GDB will look here for
+     certain supporting files or scripts.  This defaults to the `gdb'
+     subdirectory of `datadir' (which can be set using `--datadir').
+
 `configure' accepts other options, for compatibility with configuring
 other GNU tools recursively; but these are the only options that affect
 GDB or its supporting libraries.
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.29
diff -u -r1.29 acinclude.m4
--- acinclude.m4	22 Apr 2009 00:17:50 -0000	1.29
+++ acinclude.m4	23 Apr 2009 21:17:44 -0000
@@ -387,3 +387,38 @@
     AC_MSG_RESULT(${private_dir})
   fi
 ])
+
+dnl GDB_AC_WITH_DIR([VARIABLE], [ARG-NAME], [HELP], [DEFAULT])
+dnl Add a new --with option that defines a directory.
+dnl The result is stored in VARIABLE.  AC_DEFINE_DIR is called
+dnl on this variable, as is AC_SUBST.
+dnl ARG-NAME is the base name of the argument (without "--with").
+dnl HELP is the help text to use.
+dnl If the user's choice is relative to the prefix, then the
+dnl result is relocatable, then this will define the C macro
+dnl VARIABLE_RELOCATABLE to 1; otherwise it is defined as 0.
+dnl DEFAULT is the default value, which is used if the user
+dnl does not specify the argument.
+AC_DEFUN([GDB_AC_WITH_DIR], [
+  AC_ARG_WITH([$2], AS_HELP_STRING([--with-][$2][=PATH], [$3]), [
+    [$1]=$withval], [[$1]=[$4]])
+  AC_DEFINE_DIR([$1], [$1], [$3])
+  AC_SUBST([$1])
+  if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
+     if test "x$prefix" = xNONE; then
+     	test_prefix=/usr/local
+     else
+	test_prefix=$prefix
+     fi
+  else
+     test_prefix=$exec_prefix
+  fi
+  value=0
+  case ${ac_define_dir} in
+     "${test_prefix}"|"${test_prefix}/"*|\
+	'${exec_prefix}'|'${exec_prefix}/'*)
+     value=1
+     ;;
+  esac
+  AC_DEFINE_UNQUOTED([$1]_RELOCATABLE, $value, [Define if the $2 directory should be relocated when GDB is moved.])
+  ])
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.100
diff -u -r1.100 configure.ac
--- configure.ac	22 Apr 2009 00:17:50 -0000	1.100
+++ configure.ac	23 Apr 2009 21:17:45 -0000
@@ -92,31 +92,15 @@
 # generate its Makefile.in.
 AM_INIT_AUTOMAKE(gdb, UNUSED-VERSION, [no-define])
 
-debugdir=${libdir}/debug
-	 
-AC_ARG_WITH(separate-debug-dir,
-[AS_HELP_STRING([--with-separate-debug-dir=PATH], [look for global separate debug info in this path [LIBDIR/debug]])],
-[debugdir="${withval}"])
-	
-AC_DEFINE_DIR(DEBUGDIR, debugdir,
-              [Global directory for separate debug files. ])
-#AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"),
-
-if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-  if test "x$prefix" = xNONE; then
-    test_prefix=/usr/local
-  else
-    test_prefix=$prefix
-  fi
-else
-  test_prefix=$exec_prefix
-fi
-case ${debugdir} in
-"${test_prefix}"|"${test_prefix}/"*|\
-'${exec_prefix}'|'${exec_prefix}/'*)
-  AC_DEFINE(DEBUGDIR_RELOCATABLE, 1, [Define if the debug directory should be relocated when GDB is moved.])
-  ;;
-esac
+GDB_AC_WITH_DIR(DEBUGDIR, separate-debug-dir,
+    [look for global separate debug info in this path @<:@LIBDIR/debug@:>@],
+    [${libdir}/debug])
+
+# GDB's datadir relocation
+
+GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir,
+    [look for global separate data files in this path @<:@DATADIR/gdb@:>@],
+    [${datadir}/gdb])
 
 AC_ARG_WITH(relocated-sources,
 AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this path for source files]),
@@ -1479,6 +1463,7 @@
 
 dnl Handle optional features that can be enabled.
 
+target_sysroot_reloc=0
 AC_ARG_WITH(sysroot,
 AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [search for usr/lib et al within DIR]),
 [
@@ -1504,44 +1489,20 @@
  "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
  '${prefix}'|'${prefix}/'*|\
  '${exec_prefix}'|'${exec_prefix}/'*)
-   t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
-   TARGET_SYSTEM_ROOT_DEFINE="$t"
+   target_sysroot_reloc=1
    ;;
  esac
 ], [
  TARGET_SYSTEM_ROOT=
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
 ])
+TARGET_SYSTEM_ROOT_DEFINE="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE=$target_sysroot_reloc"
 AC_SUBST(TARGET_SYSTEM_ROOT)
 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
 
-system_gdbinit=
-AC_ARG_WITH(system-gdbinit,
-AS_HELP_STRING([--with-system-gdbinit=FILE], [automatically load a system-wide gdbinit file]),
-[system_gdbinit=${withval}])
-
-AC_DEFINE_DIR(SYSTEM_GDBINIT, system_gdbinit,
-              [System-wide gdbinit file.])
-
-if test "x$prefix" = xNONE; then
-  test_prefix=$ac_default_prefix
-else
-  test_prefix=$prefix
-fi
-if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-  test_exec_prefix=$test_prefix
-else
-  test_exec_prefix=$exec_prefix
-fi
-case ${system_gdbinit} in
- "${test_prefix}"|"${test_prefix}/"*|\
- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
- '${prefix}'|'${prefix}/'*|\
- '${exec_prefix}'|'${exec_prefix}/'*)
-  AC_DEFINE(SYSTEM_GDBINIT_RELOCATABLE, 1,
-            [Define if the system-wide gdbinit file should be relocated when GDB is moved.])
-   ;;
-esac
+GDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit,
+    [automatically load a system-wide gdbinit file],
+    [])
 
 AC_ARG_ENABLE(werror,
   AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.248
diff -u -r1.248 defs.h
--- defs.h	20 Mar 2009 23:04:32 -0000	1.248
+++ defs.h	23 Apr 2009 21:17:45 -0000
@@ -153,6 +153,9 @@
 /* System root path, used to find libraries etc.  */
 extern char *gdb_sysroot;
 
+/* GDB datadir, used to store data files.  */
+extern char *gdb_datadir;
+
 /* Search path for separate debug files.  */
 extern char *debug_file_directory;
 
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.74
diff -u -r1.74 main.c
--- main.c	21 Apr 2009 10:13:05 -0000	1.74
+++ main.c	23 Apr 2009 21:17:45 -0000
@@ -64,6 +64,9 @@
 /* System root path, used to find libraries etc.  */
 char *gdb_sysroot = 0;
 
+/* GDB datadir, used to store data files.  */
+char *gdb_datadir = 0;
+
 struct ui_file *gdb_stdout;
 struct ui_file *gdb_stderr;
 struct ui_file *gdb_stdlog;
@@ -95,6 +98,57 @@
 
 extern char *external_editor_command;
 
+/* Relocate a file or directory.  PROGNAME is the name by which gdb
+   was invoked (i.e., argv[0]).  INITIAL is the default value for the
+   file or directory.  FLAG is true if the value is relocatable, false
+   otherwise.  Returns a newly allocated string; this may return NULL
+   under the same conditions as make_relative_prefix.  */
+static char *
+relocate_path (const char *progname, const char *initial, int flag)
+{
+  if (flag)
+    return make_relative_prefix (progname, BINDIR, initial);
+  return xstrdup (initial);
+}
+
+/* Like relocate_path, but specifically checks for a directory.
+   INITIAL is relocated according to the rules of relocate_path.  If
+   the result is a directory, it is used; otherwise, INITIAL is used.
+   The chosen directory is then canonicalized using lrealpath.  This
+   function always returns a newly-allocated string.  */
+static char *
+relocate_directory (const char *progname, const char *initial, int flag)
+{
+  char *dir;
+
+  dir = relocate_path (progname, initial, flag);
+  if (dir)
+    {
+      struct stat s;
+
+      if (stat (dir, &s) != 0 || !S_ISDIR (s.st_mode))
+	{
+	  xfree (dir);
+	  dir = NULL;
+	}
+    }
+  if (!dir)
+    dir = xstrdup (initial);
+
+  /* Canonicalize the directory.  */
+  if (*dir)
+    {
+      char *canon_sysroot = lrealpath (dir);
+      if (canon_sysroot)
+	{
+	  xfree (dir);
+	  dir = canon_sysroot;
+	}
+    }
+
+  return dir;
+}
+
 /* Compute the locations of init files that GDB should source and return
    them in SYSTEM_GDBINIT, HOME_GDBINIT, LOCAL_GDBINIT.  If there is 
    no system gdbinit (resp. home gdbinit and local gdbinit) to be loaded,
@@ -115,24 +169,16 @@
       struct stat homebuf, cwdbuf, s;
       char *homedir, *relocated_sysgdbinit;
 
-      sysgdbinit = SYSTEM_GDBINIT;
-      if (!sysgdbinit [0] || stat (sysgdbinit, &s) != 0)
-	sysgdbinit = NULL;
-
-#ifdef SYSTEM_GDBINIT_RELOCATABLE
-      relocated_sysgdbinit = make_relative_prefix (gdb_program_name, BINDIR,
-						   SYSTEM_GDBINIT);
-      if (relocated_sysgdbinit)
+      if (SYSTEM_GDBINIT[0])
 	{
-	  struct stat s;
-	  int res = 0;
-
-	  if (stat (relocated_sysgdbinit, &s) == 0)
+	  relocated_sysgdbinit = relocate_path (gdb_program_name,
+						SYSTEM_GDBINIT,
+						SYSTEM_GDBINIT_RELOCATABLE);
+	  if (relocated_sysgdbinit && stat (relocated_sysgdbinit, &s) == 0)
 	    sysgdbinit = relocated_sysgdbinit;
 	  else
 	    xfree (relocated_sysgdbinit);
 	}
-#endif
 
       homedir = getenv ("HOME");
 
@@ -291,73 +337,14 @@
   current_directory = gdb_dirbuf;
 
   /* Set the sysroot path.  */
-#ifdef TARGET_SYSTEM_ROOT_RELOCATABLE
-  gdb_sysroot = make_relative_prefix (argv[0], BINDIR, TARGET_SYSTEM_ROOT);
-  if (gdb_sysroot)
-    {
-      struct stat s;
-      int res = 0;
+  gdb_sysroot = relocate_directory (argv[0], TARGET_SYSTEM_ROOT,
+				    TARGET_SYSTEM_ROOT_RELOCATABLE);
 
-      if (stat (gdb_sysroot, &s) == 0)
-	if (S_ISDIR (s.st_mode))
-	  res = 1;
+  debug_file_directory = relocate_directory (argv[0], DEBUGDIR,
+					     DEBUGDIR_RELOCATABLE);
 
-      if (res == 0)
-	{
-	  xfree (gdb_sysroot);
-	  gdb_sysroot = xstrdup (TARGET_SYSTEM_ROOT);
-	}
-    }
-  else
-    gdb_sysroot = xstrdup (TARGET_SYSTEM_ROOT);
-#else
-  gdb_sysroot = xstrdup (TARGET_SYSTEM_ROOT);
-#endif
-
-  /* Canonicalize the sysroot path.  */
-  if (*gdb_sysroot)
-    {
-      char *canon_sysroot = lrealpath (gdb_sysroot);
-      if (canon_sysroot)
-	{
-	  xfree (gdb_sysroot);
-	  gdb_sysroot = canon_sysroot;
-	}
-    }
-
-#ifdef DEBUGDIR_RELOCATABLE
-  debug_file_directory = make_relative_prefix (argv[0], BINDIR, DEBUGDIR);
-  if (debug_file_directory)
-    {
-      struct stat s;
-      int res = 0;
-
-      if (stat (debug_file_directory, &s) == 0)
-	if (S_ISDIR (s.st_mode))
-	  res = 1;
-
-      if (res == 0)
-	{
-	  xfree (debug_file_directory);
-	  debug_file_directory = xstrdup (DEBUGDIR);
-	}
-    }
-  else
-    debug_file_directory = xstrdup (DEBUGDIR);
-#else
-  debug_file_directory = xstrdup (DEBUGDIR);
-#endif
-
-  /* Canonicalize the debugfile path.  */
-  if (*debug_file_directory)
-    {
-      char *canon_debug = lrealpath (debug_file_directory);
-      if (canon_debug)
-	{
-	  xfree (debug_file_directory);
-	  debug_file_directory = canon_debug;
-	}
-    }
+  gdb_datadir = relocate_directory (argv[0], GDB_DATADIR,
+				    GDB_DATADIR_RELOCATABLE);
 
   get_init_files (&system_gdbinit, &home_gdbinit, &local_gdbinit);
 
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.163
diff -u -r1.163 top.c
--- top.c	25 Mar 2009 21:42:34 -0000	1.163
+++ top.c	23 Apr 2009 21:17:45 -0000
@@ -1619,6 +1619,15 @@
 			   NULL,
 			   show_exec_done_display_p,
 			   &setlist, &showlist);
+
+  add_setshow_filename_cmd ("data-directory", class_maintenance,
+                           &gdb_datadir, _("Set GDB's data directory."),
+                           _("Show GDB's data directory."),
+                           _("\
+When set, GDB uses the specified path to search for data files."),
+                           NULL, NULL,
+                           &setlist,
+                           &showlist);
 }
 
 void
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.584
diff -u -r1.584 gdb.texinfo
--- doc/gdb.texinfo	22 Apr 2009 17:24:59 -0000	1.584
+++ doc/gdb.texinfo	23 Apr 2009 21:17:49 -0000
@@ -12734,6 +12734,7 @@
 * Files::                       Commands to specify files
 * Separate Debug Files::        Debugging information in separate files
 * Symbol Errors::               Errors reading symbol files
+* Data Files::                  GDB data files
 @end menu
 
 @node Files
@@ -13568,6 +13569,36 @@
 
 @end table
 
+@node Data Files
+@section GDB Data Files
+
+@cindex prefix for data files
+@value{GDBN} will sometimes read an auxiliary data file.  These files
+are kept in a directory known as the @dfn{data directory}.
+
+You can set the data directory's name, and view the name @value{GDBN}
+is currently using.
+
+@table @code
+@kindex set data-directory
+@item set data-directory @var{directory}
+Set the directory which @value{GDBN} searches for auxiliary data files
+to @var{directory}.
+
+@kindex show data-directory
+@item show data-directory
+Show the directory @value{GDBN} searches for auxiliary data files.
+@end table
+
+@cindex default data directory
+@cindex @samp{--with-gdb-datadir}
+You can set the default data directory by using the configure-time
+@samp{--with-gdb-datadir} option.  If the data directory is inside
+@value{GDBN}'s configured binary prefix (set with @samp{--prefix} or
+@samp{--exec-prefix}), then the default data directory will be updated
+automatically if the installed @value{GDBN} is moved to a new
+location.
+
 @node Targets
 @chapter Specifying a Debugging Target
 


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23 21:27       ` Tom Tromey
@ 2009-04-24 13:47         ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2009-04-24 13:47 UTC (permalink / raw)
  To: Tom Tromey; +Cc: sergiodj, gdb-patches

> Cc: gdb-patches@sourceware.org
> From: Tom Tromey <tromey@redhat.com>
> Date: Thu, 23 Apr 2009 15:26:57 -0600
> 
> +  add_setshow_filename_cmd ("data-directory", class_maintenance,
> +                           &gdb_datadir, _("Set GDB's data directory."),
> +                           _("Show GDB's data directory."),
> +                           _("\
> +When set, GDB uses the specified path to search for data files."),
> +                           NULL, NULL,
> +                           &setlist,
> +                           &showlist);
>  }

I would suggest to add another sentence with a few examples of which
data files will be looked up in that directory.  Also, since this is a
directory (as opposed to a search path), let's not use "path" in the
doc string.

> +* Data Files::                  GDB data files

This section is not about data files, it's about where GDB finds them.
So I suggest to change the text to the right of the menu item to
"Where @value{GDBN} looks for its data files."

> +@section GDB Data Files
            ^^^
"@value{GDBN}"

> +@cindex prefix for data files
> +@value{GDBN} will sometimes read an auxiliary data file.  These files
> +are kept in a directory known as the @dfn{data directory}.

As in the doc string (and for the manual this is even more important),
I think we should tell here what files are looked up there.

Otherwise, the patch for the manual is fine.

Thanks.


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23  0:33 [PATCH 0/3] catch syscall -- try 5 -- Introduction Sérgio Durigan Júnior
  2009-04-23  1:18 ` Tom Tromey
  2009-04-23 11:49 ` Hui Zhu
@ 2009-05-07  3:22 ` Hui Zhu
  2009-05-08  1:23   ` Sérgio Durigan Júnior
  2009-05-17 20:43 ` Sérgio Durigan Júnior
  3 siblings, 1 reply; 16+ messages in thread
From: Hui Zhu @ 2009-05-07  3:22 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb-patches

It's time close to branch day.
I really want see catch syscall in 7.0.

Thanks,
Hui

2009/4/23 Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com>:
> Hello GDB hackers,
>
> Here goes my fifth attempt to get this patch accepted :-). I believe
> that everything will be fine this time, and the catch syscall feature
> will finally appear in GDB 7!
>
> Things that have changed since the last attempt:
>
> - In the documentation part:
>
> http://sourceware.org/ml/gdb-patches/2009-01/msg00492.html (from Eli)
>
> http://sourceware.org/ml/gdb-patches/2009-02/msg00013.html (from Daniel)
>
> - As for the XML support:
>
> http://sourceware.org/ml/gdb-patches/2009-01/msg00495.html (from Pierre)
>
> http://sourceware.org/ml/gdb-patches/2009-02/msg00012.html (from Daniel)
>
> - Regarding the source-code:
>
> http://sourceware.org/ml/gdb-patches/2009-01/msg00489.html (from Pedro)
>
> http://sourceware.org/ml/gdb-patches/2009-02/msg00010.html (from Daniel)
>
>
> There are other small comments that I have addressed while doing this,
> and other replies to the comments above that I didn't paste. Please, let
> me know if something is wrong/missing.
>
> There's one thing worth mentioning: this patch implements the command
> "maint set data-directory", which is already implemented by one of
> Tromey's pretty-printing patches. If Tromey's patches are accepted
> first, then I can (need) modify my patch in order to use his version of
> the command
>
> Regards,
>
> --
> Sérgio Durigan Júnior
> Linux on Power Toolchain - Software Engineer
> Linux Technology Center - LTC
> IBM Brazil
>
>


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-05-07  3:22 ` Hui Zhu
@ 2009-05-08  1:23   ` Sérgio Durigan Júnior
  2009-05-29 20:34     ` Sérgio Durigan Júnior
  0 siblings, 1 reply; 16+ messages in thread
From: Sérgio Durigan Júnior @ 2009-05-08  1:23 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches

On Thu, 2009-05-07 at 11:22 +0800, Hui Zhu wrote:
> It's time close to branch day.
> I really want see catch syscall in 7.0.

So do I :-).

So guys, is it OK to commit?  Anything else I should address?

Regards,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-04-23  0:33 [PATCH 0/3] catch syscall -- try 5 -- Introduction Sérgio Durigan Júnior
                   ` (2 preceding siblings ...)
  2009-05-07  3:22 ` Hui Zhu
@ 2009-05-17 20:43 ` Sérgio Durigan Júnior
  3 siblings, 0 replies; 16+ messages in thread
From: Sérgio Durigan Júnior @ 2009-05-17 20:43 UTC (permalink / raw)
  To: gdb-patches

Hi,

On Wed, 2009-04-22 at 21:33 -0300, Sérgio Durigan Júnior wrote:
> Hello GDB hackers,
> 
> Here goes my fifth attempt to get this patch accepted :-). I believe
> that everything will be fine this time, and the catch syscall feature
> will finally appear in GDB 7!

Ping again.

Regards,

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-05-08  1:23   ` Sérgio Durigan Júnior
@ 2009-05-29 20:34     ` Sérgio Durigan Júnior
  2009-06-29  2:15       ` Hui Zhu
  0 siblings, 1 reply; 16+ messages in thread
From: Sérgio Durigan Júnior @ 2009-05-29 20:34 UTC (permalink / raw)
  To: gdb-patches

On Thu, 2009-05-07 at 22:23 -0300, Sérgio Durigan Júnior wrote:
> On Thu, 2009-05-07 at 11:22 +0800, Hui Zhu wrote:
> > It's time close to branch day.
> > I really want see catch syscall in 7.0.
> 
> So do I :-).
> 
> So guys, is it OK to commit?  Anything else I should address?

Ping.

-- 
Sérgio Durigan Júnior
Linux on Power Toolchain - Software Engineer
Linux Technology Center - LTC
IBM Brazil


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-05-29 20:34     ` Sérgio Durigan Júnior
@ 2009-06-29  2:15       ` Hui Zhu
  2009-06-29 15:30         ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Hui Zhu @ 2009-06-29  2:15 UTC (permalink / raw)
  To: Sérgio Durigan Júnior; +Cc: gdb-patches

This cool function still not in?

2009/5/30 Sérgio Durigan Júnior <sergiodj@linux.vnet.ibm.com>:
> On Thu, 2009-05-07 at 22:23 -0300, Sérgio Durigan Júnior wrote:
>> On Thu, 2009-05-07 at 11:22 +0800, Hui Zhu wrote:
>> > It's time close to branch day.
>> > I really want see catch syscall in 7.0.
>>
>> So do I :-).
>>
>> So guys, is it OK to commit?  Anything else I should address?
>
> Ping.
>
> --
> Sérgio Durigan Júnior
> Linux on Power Toolchain - Software Engineer
> Linux Technology Center - LTC
> IBM Brazil
>
>


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

* Re: [PATCH 0/3] catch syscall -- try 5 -- Introduction
  2009-06-29  2:15       ` Hui Zhu
@ 2009-06-29 15:30         ` Tom Tromey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2009-06-29 15:30 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Sérgio Durigan Júnior, gdb-patches

>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:

Hui> This cool function still not in?

It is still waiting another review.  I hope to get to it soon, but if
someone else gets there first, that would be fine with me.

Tom


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

end of thread, other threads:[~2009-06-29 15:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23  0:33 [PATCH 0/3] catch syscall -- try 5 -- Introduction Sérgio Durigan Júnior
2009-04-23  1:18 ` Tom Tromey
2009-04-23  2:29   ` Sérgio Durigan Júnior
2009-04-23 18:23     ` Tom Tromey
2009-04-23 21:27       ` Tom Tromey
2009-04-24 13:47         ` Eli Zaretskii
2009-04-23 11:49 ` Hui Zhu
2009-04-23 15:16   ` Sérgio Durigan Júnior
2009-04-23 15:28     ` Hui Zhu
2009-04-23 15:52       ` Sérgio Durigan Júnior
2009-05-07  3:22 ` Hui Zhu
2009-05-08  1:23   ` Sérgio Durigan Júnior
2009-05-29 20:34     ` Sérgio Durigan Júnior
2009-06-29  2:15       ` Hui Zhu
2009-06-29 15:30         ` Tom Tromey
2009-05-17 20:43 ` Sérgio Durigan Júnior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox