drd: Add a consistency check
[valgrind.git] / coregrind / m_clientstate.c
blobe1a6040ae4d1ca80873c1ede088b6448b4dc8195
2 /*--------------------------------------------------------------------*/
3 /*--- A home for miscellaneous bits of information which pertain ---*/
4 /*--- to the client's state. ---*/
5 /*--- m_clientstate.c ---*/
6 /*--------------------------------------------------------------------*/
8 /*
9 This file is part of Valgrind, a dynamic binary instrumentation
10 framework.
12 Copyright (C) 2000-2013 Julian Seward
13 jseward@acm.org
15 This program is free software; you can redistribute it and/or
16 modify it under the terms of the GNU General Public License as
17 published by the Free Software Foundation; either version 2 of the
18 License, or (at your option) any later version.
20 This program is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with this program; if not, write to the Free Software
27 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28 02111-1307, USA.
30 The GNU General Public License is contained in the file COPYING.
33 #include "pub_core_basics.h"
34 #include "pub_core_vki.h"
35 #include "pub_core_xarray.h"
36 #include "pub_core_clientstate.h"
38 /*-----------------------------------------------------------------*/
39 /*--- ---*/
40 /*--- Basic globals about the address space. ---*/
41 /*--- ---*/
42 /*-----------------------------------------------------------------*/
44 /* Client address space, lowest to highest (see top of ume.c) */
45 // TODO: get rid of as many of these as possible.
47 /* ***Initial*** lowest address of the stack segment of the main thread.
48 The main stack will grow if needed but VG_(clstk_start_base) will
49 not be changed according to the growth. */
50 Addr VG_(clstk_start_base) = 0;
51 /* Initial highest address of the stack segment of the main thread. */
52 Addr VG_(clstk_end) = 0;
53 UWord VG_(clstk_id) = 0;
55 /* linux only: where is the client auxv ? */
56 /* This is set up as part of setup_client_stack in initimg-linux.c. */
57 UWord* VG_(client_auxv) = NULL;
59 Addr VG_(brk_base) = 0; /* start of brk */
60 Addr VG_(brk_limit) = 0; /* current brk */
62 /* A fd which refers to the client executable. */
63 Int VG_(cl_exec_fd) = -1;
65 /* A fd which refers to the fake /proc/<pid>/cmdline in /tmp. */
66 Int VG_(cl_cmdline_fd) = -1;
68 /* A fd which refers to the fake /proc/<pid>/auxv in /tmp. */
69 Int VG_(cl_auxv_fd) = -1;
71 // Command line pieces, after they have been extracted from argv in
72 // m_main.main(). The payload vectors are allocated in VG_AR_CORE
73 // (the default arena). They are never freed.
75 /* Args for the client. */
76 XArray* /* of HChar* */ VG_(args_for_client) = NULL;
78 /* Args for V (augments, then those from the launcher). */
79 XArray* /* of HChar* */ VG_(args_for_valgrind) = NULL;
81 /* How many of the above not to pass on at execve time? */
82 Int VG_(args_for_valgrind_noexecpass) = 0;
84 /* The name of the client executable, as specified on the command
85 line. */
86 const HChar* VG_(args_the_exename) = NULL;
88 // Client's original rlimit data and rlimit stack
89 struct vki_rlimit VG_(client_rlimit_data);
90 struct vki_rlimit VG_(client_rlimit_stack);
92 // Name of the launcher, as extracted from VALGRIND_LAUNCHER at
93 // startup.
94 HChar* VG_(name_of_launcher) = NULL;
96 /* Application-visible file descriptor limits */
97 Int VG_(fd_soft_limit) = -1;
98 Int VG_(fd_hard_limit) = -1;
100 /* Useful addresses extracted from the client */
101 /* Where is the __libc_freeres_wrapper routine we made? */
102 Addr VG_(client___libc_freeres_wrapper) = 0;
104 /* x86-linux only: where is glibc's _dl_sysinfo_int80 function?
105 Finding it isn't essential, but knowing where it is does sometimes
106 help produce better back traces. See big comment in
107 VG_(get_StackTrace) in m_stacktrace.c for further info. */
108 Addr VG_(client__dl_sysinfo_int80) = 0;
110 /* Address of the (internal) glibc nptl pthread stack cache size,
111 declared as:
112 static size_t stack_cache_actsize;
113 in nptl/allocatestack.c */
114 SizeT* VG_(client__stack_cache_actsize__addr) = 0;
116 /*--------------------------------------------------------------------*/
117 /*--- end ---*/
118 /*--------------------------------------------------------------------*/