From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28598 invoked by alias); 30 Nov 2006 13:23:32 -0000 Received: (qmail 28588 invoked by uid 22791); 30 Nov 2006 13:23:31 -0000 X-Spam-Check-By: sourceware.org Received: from ranger.systems.pipex.net (HELO ranger.systems.pipex.net) (62.241.162.32) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 30 Nov 2006 13:23:22 +0000 Received: from arthur (81-178-15-87.dsl.pipex.com [81.178.15.87]) by ranger.systems.pipex.net (Postfix) with ESMTP id 1213AE0001EF for ; Thu, 30 Nov 2006 13:23:19 +0000 (GMT) From: Nick Hudson To: gdb-patches@sources.redhat.com Subject: PATCH: Provde a pid to filename conversion for NetBSD Date: Thu, 30 Nov 2006 13:23:00 -0000 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_GttbF6Y1R2rLZgD" Message-Id: <200611301323.18743.skrll@netbsd.org> 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: 2006-11/txt/msg00418.txt.bz2 --Boundary-00=_GttbF6Y1R2rLZgD Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 580 Hi, Here's a change to provide a pid to filename conversion routine for NetBSD. If it's OK can someone please commit. Thanks, Nick 2006-11-30 Nick Hudson * i386nbsd-nat.c: Include "nbsd-nat.h". (_initialize_i386nbsd_nat): Update target vector to use nbsd_pid_to_exec_file. * config/i386/nbsdelf.mh (NATDEPFILES): Add nbsd-nat.o * nbsd-nat.c: New file. * nbsd-nat.h: New file. * Makefile.in (ALLDEPFILES): Add nbsd-nat.c. (nbsd_nat_h): New variable. (nbsd-nat.o): New dependency. --Boundary-00=_GttbF6Y1R2rLZgD Content-Type: text/x-diff; charset="us-ascii"; name="diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="diff" Content-length: 2771 ? nbsd-nat.c ? nbsd-nat.h Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.856 diff -u -p -u -r1.856 Makefile.in --- Makefile.in 28 Nov 2006 22:14:31 -0000 1.856 +++ Makefile.in 30 Nov 2006 13:15:37 -0000 @@ -758,6 +758,7 @@ mips_tdep_h = mips-tdep.h memory_map_h = memory-map.h $(memattr_h) mn10300_tdep_h = mn10300-tdep.h monitor_h = monitor.h +nbsd_nat_h = nbsd-nat.h nbsd_tdep_h = nbsd-tdep.h nto_tdep_h = nto-tdep.h $(defs_h) $(solist_h) $(osabi_h) $(regset_h) objc_lang_h = objc-lang.h @@ -1476,7 +1477,7 @@ ALLDEPFILES = \ mips-tdep.c mipsv4-nat.c \ mipsnbsd-nat.c mipsnbsd-tdep.c \ mips64obsd-nat.c mips64obsd-tdep.c \ - nbsd-tdep.c obsd-tdep.c \ + nbsd-nat.c nbsd-tdep.c obsd-tdep.c \ solib-osf.c \ somread.c solib-som.c $(HPREAD_SOURCE) \ posix-hdep.c \ @@ -2404,6 +2405,7 @@ ms1-tdep.o: ms1-tdep.c $(defs_h) $(frame $(gdb_string_h) $(regcache_h) $(reggroups_h) $(gdbcore_h) \ $(trad_frame_h) $(inferior_h) $(dwarf2_frame_h) $(infcall_h) \ $(gdb_assert_h) +nbsd-nat.o: nbsd-nat.c $(defs_h) $(nbsd_nat_h) nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_h) nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \ $(objfiles_h) $(buildsym_h) $(stabsread_h) $(block_h) Index: i386nbsd-nat.c =================================================================== RCS file: /cvs/src/src/gdb/i386nbsd-nat.c,v retrieving revision 1.16 diff -u -p -u -r1.16 i386nbsd-nat.c --- i386nbsd-nat.c 17 Dec 2005 22:34:01 -0000 1.16 +++ i386nbsd-nat.c 30 Nov 2006 13:15:42 -0000 @@ -33,6 +33,7 @@ #include #include +#include "nbsd-nat.h" #include "bsd-kvm.h" static int @@ -79,9 +80,13 @@ void _initialize_i386nbsd_nat (void); void _initialize_i386nbsd_nat (void) { - /* We've got nothing to add to the common *BSD/i386 target. */ - add_target (i386bsd_target ()); + struct target_ops *t; + /* Add some extra features to the common *BSD/i386 target. */ + t = i386bsd_target (); + t->to_pid_to_exec_file = nbsd_pid_to_exec_file; + add_target (t); + /* Support debugging kernel virtual memory images. */ bsd_kvm_add_target (i386nbsd_supply_pcb); } Index: config/i386/nbsdelf.mh =================================================================== RCS file: /cvs/src/src/gdb/config/i386/nbsdelf.mh,v retrieving revision 1.23 diff -u -p -u -r1.23 nbsdelf.mh --- config/i386/nbsdelf.mh 24 Nov 2006 18:23:34 -0000 1.23 +++ config/i386/nbsdelf.mh 30 Nov 2006 13:15:42 -0000 @@ -1,5 +1,5 @@ # Host: NetBSD/i386 ELF NATDEPFILES= fork-child.o inf-ptrace.o \ - i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o + nbsd-nat.o i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o LOADLIBES= -lkvm --Boundary-00=_GttbF6Y1R2rLZgD Content-Type: text/x-csrc; charset="us-ascii"; name="nbsd-nat.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nbsd-nat.c" Content-length: 1221 /* NetBSD-specific methods for using the /proc file system. Copyright 2006 Free Software Foundation, Inc. This file is part of GDB. 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "defs.h" #include "nbsd-nat.h" char * nbsd_pid_to_exec_file (int pid) { size_t len = MAXPATHLEN; char *buf = xcalloc (len, sizeof (char)); char *path; path = xstrprintf ("/proc/%d/exe", pid); if (readlink (path, buf, MAXPATHLEN) == -1) { xfree (buf); buf = NULL; } xfree (path); return buf; } --Boundary-00=_GttbF6Y1R2rLZgD Content-Type: text/x-chdr; charset="us-ascii"; name="nbsd-nat.h" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nbsd-nat.h" Content-length: 1070 /* Native-dependent code for NetBSD. Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GDB. 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef NBSD_NAT_H #define NBSD_NAT_H /* Return a the name of file that can be opened to get the symbols for the child process identified by PID. */ extern char *nbsd_pid_to_exec_file (int pid); #endif /* nbsd-nat.h */ --Boundary-00=_GttbF6Y1R2rLZgD--