From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16764 invoked by alias); 30 Mar 2010 00:02:02 -0000 Received: (qmail 16297 invoked by uid 22791); 30 Mar 2010 00:02:01 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Mar 2010 00:01:55 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2U01p0u009404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 29 Mar 2010 20:01:51 -0400 Received: from psique.localnet (vpn-235-170.phx2.redhat.com [10.3.235.170]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2U01n4Q019334 for ; Mon, 29 Mar 2010 20:01:50 -0400 From: Sergio Durigan Junior To: gdb-patches@sourceware.org Subject: Fix for PR 10736 Date: Tue, 30 Mar 2010 00:02:00 -0000 User-Agent: KMail/1.13.1 (Linux/2.6.32.9-70.fc12.x86_64; KDE/4.4.1; x86_64; ; ) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201003292101.48377.sergiodj@redhat.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg01035.txt.bz2 Hello guys, The following patch is a fix for PR 10736. OK? -- Sergio Durigan Junior Debugger Engineer Red Hat Inc. 2010-03-23 Sergio Durigan Junior 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. 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