aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2010-04-05 15:58:53 +0000
committerSergio Durigan Junior <sergiodj@redhat.com>2010-04-05 15:58:53 +0000
commit626ea16dd6ae258a8328df5949f7942d14e9191d (patch)
tree745c7b497a88808bf41aa3c891b2ff7f2f763aac /gdb
parent1f7ccab234e356984a723f5089e812874cb50a06 (diff)
downloadgdb-626ea16dd6ae258a8328df5949f7942d14e9191d.zip
gdb-626ea16dd6ae258a8328df5949f7942d14e9191d.tar.gz
gdb-626ea16dd6ae258a8328df5949f7942d14e9191d.tar.bz2
2010-03-23 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/10736: * xml-syscall.c (my_gdb_datadir): New variable to keep track of the changes in data-directory. (init_sysinfo): Reload the syscall XML file if the data-directory has changed.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/xml-syscall.c22
2 files changed, 29 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b1fb947..25f8a1d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2010-04-05 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ PR gdb/10736:
+ * xml-syscall.c (my_gdb_datadir): New variable to keep track of
+ the changes in data-directory.
+ (init_sysinfo): Reload the syscall XML file if the data-directory
+ has changed.
+
2010-04-05 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup.
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 3f5585c..2a4d010 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -80,6 +80,10 @@ get_syscall_names (void)
#else /* ! HAVE_LIBEXPAT */
+/* Variable that will hold the last known data-directory. This is useful to
+ know whether we should re-read the XML info for the target. */
+static char *my_gdb_datadir = NULL;
+
/* Structure which describes a syscall. */
typedef struct syscall_desc
{
@@ -291,6 +295,18 @@ xml_init_syscalls_info (const char *filename)
static void
init_sysinfo (void)
{
+ /* Should we re-read the XML info for this target? */
+ if (my_gdb_datadir && strcmp (my_gdb_datadir, gdb_datadir) != 0)
+ {
+ /* The data-directory changed from the last time we used it.
+ It means that we have to re-read the XML info. */
+ have_initialized_sysinfo = 0;
+ xfree (my_gdb_datadir);
+ my_gdb_datadir = NULL;
+ if (sysinfo)
+ free_syscalls_info ((void *) sysinfo);
+ }
+
/* Did we already try to initialize the structure? */
if (have_initialized_sysinfo)
return;
@@ -303,7 +319,8 @@ init_sysinfo (void)
{
if (xml_syscall_file)
warning (_("\
-Could not load the syscall XML file `%s'."), xml_syscall_file);
+Could not load the syscall XML file `%s/%s'."),
+ gdb_datadir, xml_syscall_file);
else
warning (_("\
There is no XML file to open."));
@@ -312,6 +329,9 @@ There is no XML file to open."));
GDB will not be able to display syscall names nor to verify if\n\
any provided syscall numbers are valid."));
}
+
+ /* Saving the data-directory used to read this XML info. */
+ my_gdb_datadir = xstrdup (gdb_datadir);
}
static int