* amd64obsd-tdep.c (amd64obsd_pc_in_sigtramp): Adjust for signal
[deliverable/binutils-gdb.git] / gdb / i386obsd-nat.c
CommitLineData
baadce09 1/* Native-dependent code for OpenBSD/i386.
e2dbbd2d 2 Copyright 2002, 2003 Free Software Foundation, Inc.
baadce09
MK
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21#include "defs.h"
22
23#include <sys/param.h>
24#include <sys/sysctl.h>
25
e2dbbd2d
MK
26#include "i386-tdep.h"
27
baadce09 28/* Prevent warning from -Wmissing-prototypes. */
e5e4acad 29void _initialize_i386obsd_nat (void);
baadce09
MK
30
31void
32_initialize_i386obsd_nat (void)
33{
34 /* OpenBSD provides a vm.psstrings sysctl that we can use to locate
35 the sigtramp. That way we can still recognize a sigtramp if its
36 location is changed in a new kernel. This is especially
37 important for OpenBSD, since it uses a different memory layout
38 than NetBSD, yet we cannot distinguish between the two.
39
40 Of course this is still based on the assumption that the sigtramp
41 is placed directly under the location where the program arguments
42 and environment can be found. */
43#ifdef VM_PSSTRINGS
44 {
45 struct _ps_strings _ps;
46 int mib[2];
47 size_t len;
48
baadce09
MK
49 mib[0] = CTL_VM;
50 mib[1] = VM_PSSTRINGS;
51 len = sizeof (_ps);
52 if (sysctl (mib, 2, &_ps, &len, NULL, 0) == 0)
53 {
005328e3
MK
54 i386obsd_sigtramp_start = (CORE_ADDR)_ps.val - 128;
55 i386obsd_sigtramp_end = (CORE_ADDR)_ps.val;
baadce09
MK
56 }
57 }
58#endif
59}
This page took 0.175172 seconds and 4 git commands to generate.