From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13523 invoked by alias); 7 Dec 2004 17:31:22 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13475 invoked from network); 7 Dec 2004 17:31:16 -0000 Received: from unknown (HELO krynn.se.axis.com) (193.13.178.10) by sourceware.org with SMTP; 7 Dec 2004 17:31:16 -0000 Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.83.5.18]) by krynn.se.axis.com (8.12.9/8.12.9/Debian-5local0.1) with ESMTP id iB7HVFAD013477; Tue, 7 Dec 2004 18:31:15 +0100 Received: from ignucius.se.axis.com (localhost [127.0.0.1]) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) with ESMTP id iB7HVFdD006261; Tue, 7 Dec 2004 18:31:15 +0100 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id iB7HVFHQ006257; Tue, 7 Dec 2004 18:31:15 +0100 Date: Tue, 07 Dec 2004 17:33:00 -0000 Message-Id: <200412071731.iB7HVFHQ006257@ignucius.se.axis.com> From: Hans-Peter Nilsson To: gdb-patches@sources.redhat.com In-reply-to: <200412061654.iB6GsCAe005075@ignucius.se.axis.com> (message from Hans-Peter Nilsson on Mon, 6 Dec 2004 17:54:12 +0100) Subject: Re: [RFA:] sim --sysroot=... option. X-SW-Source: 2004-12/txt/msg00205.txt.bz2 > Date: Mon, 6 Dec 2004 17:54:12 +0100 > From: Hans-Peter Nilsson > * nrun.c (main): If simulator_sysroot is not empty, chdir there. > * run.c (main): Ditto. After doing a test-build of all buildable simulators in CVS, (covered by arm-elf frv-elf h8300-elf m32r-elf m68hc11-elf mcore-elf mips-elf mn10300-elf powerpc-elf v850-elf), I'd like to retract the run.c part, which is just for an obsolete interface, and doesn't include sim-config.h (or apparently the option handler or the other bits from sim/common). I'd also like to like to replace the nrun.c patch with one that also includes unistd.h to get the chdir prototype (else there's a compilation warning, but only for *some* simulators; presumable target header files include unistd.h in some cases). Sorry for the extra reading. * nrun.c [HAVE_UNISTD_H]: Include unistd.h. (main): If simulator_sysroot is not empty, chdir there. Index: nrun.c =================================================================== RCS file: /cvs/src/src/sim/common/nrun.c,v retrieving revision 1.4 diff -c -p -r1.4 nrun.c *** nrun.c 23 Jun 2003 18:03:17 -0000 1.4 --- nrun.c 7 Dec 2004 17:27:27 -0000 *************** *** 1,5 **** /* New version of run front end support for simulators. ! Copyright (C) 1997 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,5 ---- /* New version of run front end support for simulators. ! Copyright (C) 1997, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by *************** with this program; if not, write to the *** 24,29 **** --- 24,34 ---- extern char **environ; #endif + #ifdef HAVE_UNISTD_H + /* For chdir. */ + #include + #endif + static void usage (void); extern host_callback default_callback; *************** main (int argc, char **argv) *** 117,122 **** --- 122,137 ---- sim_create_inferior (sd, prog_bfd, prog_argv, NULL); #endif + /* To accommodate relative file paths, chdir to sysroot now. We + mustn't do this until BFD has opened the program, else we wouldn't + find the executable if it has a relative file path. */ + if (simulator_sysroot[0] != '\0' && chdir (simulator_sysroot) < 0) + { + fprintf (stderr, "%s: can't change directory to \"%s\"\n", + myname, simulator_sysroot); + exit (1); + } + /* Run/Step the program. */ if (single_step) { brgds, H-P