1/*
2 * Copyright (c) 2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_APACHE_LICENSE_HEADER_START@
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * @APPLE_APACHE_LICENSE_HEADER_END@
19 */
20/*
21    auto_gdb_interface.h
22    Routines called by gdb to implement its info gc-references and gc-roots commands.
23    Copyright (c) 2007-2011 Apple Inc. All rights reserved.
24 */
25
26#ifndef __AUTO_GDB_INTERFACE__
27#define __AUTO_GDB_INTERFACE__
28
29#include <stdint.h>
30#include <sys/types.h>
31#include <auto_zone.h>
32
33__BEGIN_DECLS
34
35enum {
36    auto_memory_block_global = 0,
37    auto_memory_block_stack,
38    auto_memory_block_object,
39    auto_memory_block_bytes,
40    auto_memory_block_association
41};
42typedef uint32_t auto_memory_block_kind_t;
43
44struct auto_memory_reference {
45    void                           *address;
46    intptr_t                        offset;
47    auto_memory_block_kind_t        kind;
48    uint32_t                        retainCount;
49};
50typedef struct auto_memory_reference auto_memory_reference_t;
51
52struct auto_memory_reference_list {
53    uint32_t                        count;
54    auto_memory_reference_t         references[0];
55};
56typedef struct auto_memory_reference_list auto_memory_reference_list_t;
57
58struct auto_root_list {
59    uint32_t                        count;
60    auto_memory_reference_list_t    roots[0];       // variable length structure, size = count * sizeof(auto_memory_reference_list_t) + sum(i, 0, count) { roots[i].count * sizeof(auto_memory_reference_t) }
61};
62typedef struct auto_root_list auto_root_list_t;
63
64AUTO_EXPORT auto_memory_reference_list_t *auto_gdb_enumerate_references(auto_zone_t *zone, void *address, void *stack_base)
65    __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
66
67AUTO_EXPORT auto_root_list_t *auto_gdb_enumerate_roots(auto_zone_t *zone, void *address, void *stack_base)
68    __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
69
70__END_DECLS
71
72#endif /* __AUTO_GDB_INTERFACE__ */
73