diff options
author | Mark Kettenis <kettenis@gnu.org> | 2002-07-04 15:13:28 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2002-07-04 15:13:28 +0000 |
commit | baadce09a627f7c55659c59a1009a8812111c42a (patch) | |
tree | 1c4590a3474d29164c08610a6b892d861cc7c8f9 /gdb/i386obsd-nat.c | |
parent | 2404952e63ce440e3b9896f20256887d9d888c63 (diff) | |
download | gdb-baadce09a627f7c55659c59a1009a8812111c42a.zip gdb-baadce09a627f7c55659c59a1009a8812111c42a.tar.gz gdb-baadce09a627f7c55659c59a1009a8812111c42a.tar.bz2 |
* i386bsd-tdep.c (i386nbsd_sigtramp_start, i386nbsd_sigtramp_end):
New variables.
(i386nbsd_init_abi): Use these to initialize tdep->sigtramp_start
and tdep->sigtramp_end.
* i386obsd-nat.c: New file.
* config/i386/obsd.mh (NATDEPFILES): Add i386obsd-nat.o.
Diffstat (limited to 'gdb/i386obsd-nat.c')
-rw-r--r-- | gdb/i386obsd-nat.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gdb/i386obsd-nat.c b/gdb/i386obsd-nat.c new file mode 100644 index 0000000..01a2bbe --- /dev/null +++ b/gdb/i386obsd-nat.c @@ -0,0 +1,60 @@ +/* Native-dependent code for OpenBSD/i386. + Copyright 2002 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 "defs.h" + +#include <sys/param.h> +#include <sys/sysctl.h> + +/* Prevent warning from -Wmissing-prototypes. */ +void _initialize_i386fbsd_nat (void); + +void +_initialize_i386obsd_nat (void) +{ + /* OpenBSD provides a vm.psstrings sysctl that we can use to locate + the sigtramp. That way we can still recognize a sigtramp if its + location is changed in a new kernel. This is especially + important for OpenBSD, since it uses a different memory layout + than NetBSD, yet we cannot distinguish between the two. + + Of course this is still based on the assumption that the sigtramp + is placed directly under the location where the program arguments + and environment can be found. */ +#ifdef VM_PSSTRINGS + { + struct _ps_strings _ps; + int mib[2]; + size_t len; + + extern CORE_ADDR i386nbsd_sigtramp_start; + extern CORE_ADDR i386nbsd_sigtramp_end; + + mib[0] = CTL_VM; + mib[1] = VM_PSSTRINGS; + len = sizeof (_ps); + if (sysctl (mib, 2, &_ps, &len, NULL, 0) == 0) + { + i386nbsd_sigtramp_start = (CORE_ADDR)_ps.val - 128; + i386nbsd_sigtramp_end = (CORE_ADDR)_ps.val; + } + } +#endif +} |