2002-07-04 17:13:28 +02:00
|
|
|
/* Native-dependent code for OpenBSD/i386.
|
2004-02-22 12:19:15 +01:00
|
|
|
|
2005-12-17 23:34:03 +01:00
|
|
|
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
2002-07-04 17:13:28 +02:00
|
|
|
|
|
|
|
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
|
2005-12-17 23:34:03 +01:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2002-07-04 17:13:28 +02:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
|
2003-08-10 20:32:09 +02:00
|
|
|
#include "i386-tdep.h"
|
|
|
|
|
2002-07-04 17:13:28 +02:00
|
|
|
/* Prevent warning from -Wmissing-prototypes. */
|
2002-07-04 17:17:43 +02:00
|
|
|
void _initialize_i386obsd_nat (void);
|
2002-07-04 17:13:28 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
mib[0] = CTL_VM;
|
|
|
|
mib[1] = VM_PSSTRINGS;
|
|
|
|
len = sizeof (_ps);
|
|
|
|
if (sysctl (mib, 2, &_ps, &len, NULL, 0) == 0)
|
|
|
|
{
|
2004-11-19 22:55:24 +01:00
|
|
|
i386obsd_sigtramp_start_addr = (u_long) _ps.val - 128;
|
|
|
|
i386obsd_sigtramp_end_addr = (u_long) _ps.val;
|
2002-07-04 17:13:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|