]> git.saurik.com Git - apple/dyld.git/blob - include/mach-o/dyld_gdb.h
dyld-239.3.tar.gz
[apple/dyld.git] / include / mach-o / dyld_gdb.h
1 /*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 #ifndef _DYLD_GDB_
24 #define _DYLD_GDB_
25
26 /*
27 * For Mac OS X 10.4 or later, use the interface in mach-o/dylib_images.h
28 */
29 #include <mach-o/dyld_images.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /*
36 * Prior to Mac OS 10.4, this is the interface gdb used to discover the mach-o images loaded in a process
37 */
38 #if __i386__
39 /*
40 * gdb_dyld_version is the version of gdb interface that dyld is currently
41 * exporting. For the interface described in this header file gdb_dyld_version
42 * is 2. As the gdb/dyld interface changes this number will be incremented and
43 * comments will be added as to what are the are changes for the various
44 * versions.
45 */
46 extern unsigned int gdb_dyld_version;
47
48 /*
49 * gdb_dyld_state_changed is the internal dyld routine called by dyld to notify
50 * gdb that the state of the data structures has changed. gdb is expected to
51 * put a break point on this routine and re-read the internal dyld data
52 * structures below when this break point is hit.
53 */
54 extern void gdb_dyld_state_changed(void);
55
56 /*
57 * gdb looks directly at parts of two of dyld's internal data structures. The
58 * list of object file images and the list of library images. The parts of
59 * these structures that gdb looks at will not change unless the value of
60 * gdb_dyld_version changes. The size of these structures and the other fields
61 * that gdb does not look at may change.
62 *
63 * struct object_images {
64 * struct object_image images[NOBJECT_IMAGES];
65 * unsigned long nimages;
66 * struct object_images *next_images;
67 * ...
68 * };
69 *
70 * struct library_images {
71 * struct library_image images[NLIBRARY_IMAGES];
72 * unsigned long nimages;
73 * struct library_images *next_images;
74 * ...
75 * };
76 *
77 * Both the object_image structure and the library_image structure
78 * start with a structure containing the following fields:
79 *
80 * struct image {
81 * char *physical_name; physical image name (file name)
82 * unsigned long vmaddr_slide; the slide from the staticly linked address
83 * struct mach_header *mh; address of the mach header of the image
84 * unsigned long valid; TRUE if this is struct is valid
85 * char *name; image name for reporting errors
86 * ...
87 * };
88 *
89 * In gdb_dyld_version 1 the first field was "name". In gdb_dyld_version 2 the
90 * first field was changed to "physical_name" and a new fifth field "name" was
91 * added. These two fields are set to the same values except in the case of
92 * zero-link. In zero-link the NSLinkModule() option
93 * NSLINKMODULE_OPTION_TRAILING_PHYS_NAME is used and then the physical_name is
94 * the file name of the module zero-link loaded that is part of the logical
95 * image "name".
96 */
97
98 /* object_images is the global object_images structure */
99
100 /* the number of gdb_object_image structures present per bucket */
101 extern unsigned int gdb_nobject_images;
102
103 /* the size of each gdb_object_image structure */
104 extern unsigned int gdb_object_image_size;
105
106 /* library_images is the global library_images structure */
107
108 /* the number of gdb_library_image structures present per bucket */
109 extern unsigned int gdb_nlibrary_images;
110
111 /* the size of each gdb_library_image structure */
112 extern unsigned int gdb_library_image_size;
113
114 #endif
115
116
117
118 #ifdef __cplusplus
119 }
120 #endif
121
122 #endif /* _DYLD_GDB_ */