blob: b2a2f98f610b4fcc82f4ec1539e3694ecaaa1bcd [file] [log] [blame]
sewardj45f4e7c2005-09-27 19:20:21 +00001
2/*--------------------------------------------------------------------*/
3/*--- Misc client state info pub_core_clientstate.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
sewardj03f8d3f2012-08-05 15:46:46 +000010 Copyright (C) 2000-2012 Julian Seward
sewardj45f4e7c2005-09-27 19:20:21 +000011 jseward@acm.org
12
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
27
28 The GNU General Public License is contained in the file COPYING.
29*/
30
31#ifndef __PUB_CORE_CLIENTSTATE_H
32#define __PUB_CORE_CLIENTSTATE_H
33
34//--------------------------------------------------------------------
35// PURPOSE: This module holds various bits of client state which don't
36// live comfortably anywhere else. Note that the ThreadStates for the
sewardjfdf91b42005-09-28 00:53:09 +000037// client don't live here; they instead live in m_threadstate.h. Most
38// of these values are set once at startup and not changed later.
sewardj45f4e7c2005-09-27 19:20:21 +000039//--------------------------------------------------------------------
40
41#include "pub_tool_clientstate.h"
42
43// Address space globals
44
sewardj45f4e7c2005-09-27 19:20:21 +000045extern Addr VG_(clstk_base); // client stack range
46extern Addr VG_(clstk_end);
47extern UWord VG_(clstk_id); // client stack id
48
sewardj2a312392011-06-26 09:26:48 +000049/* linux only: where is the client auxv ? */
50/* This is setup as part of setup_client_stack in initimg-linux.c. */
51extern UWord* VG_(client_auxv);
52
sewardj45f4e7c2005-09-27 19:20:21 +000053extern Addr VG_(brk_base); // start of brk
54extern Addr VG_(brk_limit); // current brk
55
56/* A fd which refers to the client executable. */
57extern Int VG_(cl_exec_fd);
58
59/* A fd which refers to the fake /proc/<pid>/cmdline in /tmp. The
60 idea is: make up the /proc/<pid>/cmdline file the client would
61 expect to see if it was running natively. Copy into a file in
62 /tmp. When the client then does an open of /proc/<pid>/cmdline or
63 /proc/self/cmdline, instead give it a file handle to the file in
64 /tmp. The problem of deleting said file when Valgrind exits is
65 neatly sidestepped by unlinking it as soon as it has been created,
66 but holding on to the file handle. That causes the kernel to keep
67 the file contents alive exactly until the process exits. */
68extern Int VG_(cl_cmdline_fd);
69
tom41ad7e72012-10-04 20:27:38 +000070/* Same as above, but for /proc/<pid>/auxv. */
71extern Int VG_(cl_auxv_fd);
72
sewardj45f4e7c2005-09-27 19:20:21 +000073// Client's original rlimit data and rlimit stack
74extern struct vki_rlimit VG_(client_rlimit_data);
75extern struct vki_rlimit VG_(client_rlimit_stack);
76
77// Name of the launcher, as extracted from VALGRIND_LAUNCHER at
78// startup.
79extern HChar* VG_(name_of_launcher);
80
sewardjfdf91b42005-09-28 00:53:09 +000081/* Application-visible file descriptor limits */
82extern Int VG_(fd_soft_limit);
83extern Int VG_(fd_hard_limit);
84
sewardj0ec07f32006-01-12 12:32:32 +000085/* Useful addresses extracted from the client */
86/* Where is the __libc_freeres_wrapper routine we made? */
87extern Addr VG_(client___libc_freeres_wrapper);
sewardj45f4e7c2005-09-27 19:20:21 +000088
sewardja672ea32006-04-29 18:03:14 +000089/* x86-linux only: where is ld.so's _dl_sysinfo_int80 function?
90 Finding it isn't essential, but knowing where it is does sometimes
91 help produce better back traces. See big comment in
92 VG_(get_StackTrace) in m_stacktrace.c for further info. */
93extern Addr VG_(client__dl_sysinfo_int80);
94
95
sewardj45f4e7c2005-09-27 19:20:21 +000096#endif // __PUB_CORE_CLIENTSTATE_H
97
98/*--------------------------------------------------------------------*/
99/*--- end ---*/
100/*--------------------------------------------------------------------*/