* PATCH: Provde a pid to filename conversion for NetBSD
@ 2006-11-30 13:23 Nick Hudson
2006-12-15 16:23 ` Nick Hudson
0 siblings, 1 reply; 7+ messages in thread
From: Nick Hudson @ 2006-11-30 13:23 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
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 <skrll@netbsd.org>
* 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.
[-- Attachment #2: diff --]
[-- Type: text/x-diff, Size: 2771 bytes --]
? 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 <machine/frame.h>
#include <machine/pcb.h>
+#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
[-- Attachment #3: nbsd-nat.c --]
[-- Type: text/x-csrc, Size: 1221 bytes --]
/* 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 <sys/param.h>
#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;
}
[-- Attachment #4: nbsd-nat.h --]
[-- Type: text/x-chdr, Size: 1070 bytes --]
/* 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 */
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Provde a pid to filename conversion for NetBSD
2006-11-30 13:23 PATCH: Provde a pid to filename conversion for NetBSD Nick Hudson
@ 2006-12-15 16:23 ` Nick Hudson
2006-12-15 16:37 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Nick Hudson @ 2006-12-15 16:23 UTC (permalink / raw)
To: gdb-patches
On Thursday 30 November 2006 13:23, Nick Hudson wrote:
> 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 <skrll@netbsd.org>
>
> * 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.
What needs to happen for this to go in?
Thanks,
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Provde a pid to filename conversion for NetBSD
2006-12-15 16:23 ` Nick Hudson
@ 2006-12-15 16:37 ` Daniel Jacobowitz
2006-12-16 8:46 ` Nick Hudson
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-12-15 16:37 UTC (permalink / raw)
To: Nick Hudson; +Cc: gdb-patches
On Fri, Dec 15, 2006 at 04:23:30PM +0000, Nick Hudson wrote:
> > 2006-11-30 Nick Hudson <skrll@netbsd.org>
> >
> > * 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.
>
> What needs to happen for this to go in?
Someone needs to review it. I was hoping that someone who actually
used NetBSD would speak up :-) If no one does, I'll do it myself.
It looks generally fine. Is this going to work for every NetBSD
platform? Should it be added to all of them, rather than just i386?
Looks like GDB supports 11.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Provde a pid to filename conversion for NetBSD
2006-12-15 16:37 ` Daniel Jacobowitz
@ 2006-12-16 8:46 ` Nick Hudson
2006-12-16 11:18 ` Mark Kettenis
0 siblings, 1 reply; 7+ messages in thread
From: Nick Hudson @ 2006-12-16 8:46 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Friday 15 December 2006 16:37, Daniel Jacobowitz wrote:
> On Fri, Dec 15, 2006 at 04:23:30PM +0000, Nick Hudson wrote:
> > > 2006-11-30 Nick Hudson <skrll@netbsd.org>
> > >
> > > * 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.
> >
> > What needs to happen for this to go in?
>
> Someone needs to review it. I was hoping that someone who actually
> used NetBSD would speak up :-) If no one does, I'll do it myself.
I sent Jason Thorpe (current NetBSD maintainer) an email, but got not
response. :(
> It looks generally fine. Is this going to work for every NetBSD
> platform? Should it be added to all of them, rather than just i386?
> Looks like GDB supports 11.
I have diffs to add support to all other NetBSD platforms which I committed to
the NetBSD tree recently. I'll send those after this one goes in.
Thanks,
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Provde a pid to filename conversion for NetBSD
2006-12-16 8:46 ` Nick Hudson
@ 2006-12-16 11:18 ` Mark Kettenis
2006-12-16 17:03 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Mark Kettenis @ 2006-12-16 11:18 UTC (permalink / raw)
To: Nick Hudson; +Cc: Daniel Jacobowitz, gdb-patches
> On Friday 15 December 2006 16:37, Daniel Jacobowitz wrote:
> > On Fri, Dec 15, 2006 at 04:23:30PM +0000, Nick Hudson wrote:
> > > > 2006-11-30 Nick Hudson <skrll@netbsd.org>
> > > >
> > > > * 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.
> > >
> > > What needs to happen for this to go in?
> >
> > Someone needs to review it. I was hoping that someone who actually
> > used NetBSD would speak up :-) If no one does, I'll do it myself.
>
> I sent Jason Thorpe (current NetBSD maintainer) an email, but got not
> response. :(
Reasoning that NetBSD and OpenBSD are similar enough, I suppose I can do
it. You're origional diff broke OpenBSD/i386 support, since it re-used
the NetBSD/i386 native code, but I've solved that by moving some code
from i386nbsd-nat.c to i386obsd-nat.c. If I ever get to implement this
for OpenBSD it will not use /proc, and I had some other reasons to make
the seperation anyway. Anyway, your diff looks pretty good, except for
some minor nits:
* Always include "defs.h" first.
* The FSF lawyers have apparently changed their mind again, and we should
use Copyright (C) again.
* Make sure the dependencies in Makefile.in are up to date; you forgot to
add a dependency rule for nbsd-nat.o.
I'll fix those when I commit the diff.
However, before I can do that, I need to be sure you've got an FSF
copyright assignment for GDB in place. Or Daniel, do you think there
is not enough origional code here to warrant one?
> > It looks generally fine. Is this going to work for every NetBSD
> > platform? Should it be added to all of them, rather than just i386?
> > Looks like GDB supports 11.
>
> I have diffs to add support to all other NetBSD platforms which I
> committed to
> the NetBSD tree recently. I'll send those after this one goes in.
Ah, that'd be good. Perhaps that means that a few more NetBSD/OpenBSD
seperation diffs are needed, but that's not a big problem.
> Thanks,
> Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Provde a pid to filename conversion for NetBSD
2006-12-16 11:18 ` Mark Kettenis
@ 2006-12-16 17:03 ` Daniel Jacobowitz
2006-12-17 14:32 ` Mark Kettenis
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-12-16 17:03 UTC (permalink / raw)
To: Mark Kettenis; +Cc: Nick Hudson, gdb-patches
On Sat, Dec 16, 2006 at 12:18:23PM +0100, Mark Kettenis wrote:
> However, before I can do that, I need to be sure you've got an FSF
> copyright assignment for GDB in place. Or Daniel, do you think there
> is not enough origional code here to warrant one?
I think that there is enough code to warrant assignment, but
fortunately Nick's got one in place already :-)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Provde a pid to filename conversion for NetBSD
2006-12-16 17:03 ` Daniel Jacobowitz
@ 2006-12-17 14:32 ` Mark Kettenis
0 siblings, 0 replies; 7+ messages in thread
From: Mark Kettenis @ 2006-12-17 14:32 UTC (permalink / raw)
To: Mark Kettenis, Nick Hudson, gdb-patches
> On Sat, Dec 16, 2006 at 12:18:23PM +0100, Mark Kettenis wrote:
> > However, before I can do that, I need to be sure you've got an FSF
> > copyright assignment for GDB in place. Or Daniel, do you think there
> > is not enough origional code here to warrant one?
>
> I think that there is enough code to warrant assignment, but
> fortunately Nick's got one in place already :-)
Cool. I committed Nick's diff with a few minor fixes.
Thanks Nick!
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-12-17 14:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-30 13:23 PATCH: Provde a pid to filename conversion for NetBSD Nick Hudson
2006-12-15 16:23 ` Nick Hudson
2006-12-15 16:37 ` Daniel Jacobowitz
2006-12-16 8:46 ` Nick Hudson
2006-12-16 11:18 ` Mark Kettenis
2006-12-16 17:03 ` Daniel Jacobowitz
2006-12-17 14:32 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox