blob: 0eb1a3df6f06716d2a3939e463b23dd22bad143f [file] [log] [blame]
njn009af892004-12-01 11:54:07 +00001-------------------------------------------------------------------
2Guide to the directory structure
3-------------------------------------------------------------------
4Valgrind has 2 main levels of genericity.
5
6 1. Multiple tools, plus the core.
7 2. Multiple architectures, OSes, and platforms (arch/OS combinations).
8
9This requires a moderately complex directory structure. This file is a
10guide to where different things live.
11
12
13Basic layout
14------------
151. Core stuff lives in:
16 - include/ for declarations that must be seen by tools
17 - coregrind/ for code that need not be seen by tools
18 - coregrind/demangle/ the demangler
19
20 Tool stuff lives in:
21 - $TOOL/ main files
22 - $TOOL/tests regression tests
23 - $TOOL/docs documentation
24
25 Other stuff lives in:
26 - docs/ main, non-tool-specific docs
27 - tests/ regression test machinery
28 - nightly/ overnight test stuff (should be in tests/)
29 - auxprogs/ auxiliary programs
30
312. Generic things go in the directory specified in (1).
32
33 Arch-specific, OS-specific, or platform-specific things go within a
34 subdirectory of the directory specified by step (1) above.
35
36 For example:
37 - Cachegrind's main generic code goes in cachegrind/.
38 - Cachegrind's x86-specific code goes in cachegrind/x86/.
39 - Cachegrind's x86-specific tests go in cachegrind/tests/x86/.
40 - x86/Linux-specific declarations that must be visible to tools go in
41 include/x86-linux/.
42
43
44Guide to headers
45----------------
46Finding declarations in headers is not always easy. The above rules dictate
47which directory something should go in. As well as that, there are some things
48that must be visible in both C and assembly code files, but most things only be
49visible in C files; things that must be both C-visible and asm-visible go in
50files called *_asm.h.
51
52The most important header files are (at the time of writing):
53- include/tool.h (auto-generated from tool.h.base + toolfuncs.def)
54- include/tool_asm.h
55- $ARCH/tool_arch.h
56- $OS/vki.h
57- $PLATFORM/vki*.h
58- coregrind/{core.h,core_asm.h}
59- $ARCH/{core_arch.h,core_arch_asm.h}
60- $OS/core_os.h
61- $PLATFORM/{core_platform.h,vki_unistd.h}
62
63There are a few others, but that is most of them.
64
65Having read the above text, it should be clear what is found in each of them.
66For example, coregrind/core_asm.h contains all the generic
67(non-arch/OS/platform-specific) declarations which should not be seen by
68tools and must be visible to both C and asm code.
69
70When searching for something, rgrep is very useful. If you don't have a
71version of rgrep, use a command something like this:
72
73 find . -name '*.h' | xargs grep <pattern>
74
75The comment at the top of coregrind/core.h has some additional information
76about the exact hierarchy of the header files, but those details aren't
77important for just finding and placing things.
78