FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
symbol_table.h
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _CORKSCREW_SYMBOL_TABLE_H
18#define _CORKSCREW_SYMBOL_TABLE_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#ifdef __cplusplus
24extern "C"
25{
26#endif
27
28 typedef struct
29 {
30 uintptr_t start;
31 uintptr_t end;
32 char* name;
33 } symbol_t;
34
35 typedef struct
36 {
37 symbol_t* symbols;
38 size_t num_symbols;
40
41 /*
42 * Loads a symbol table from a given file.
43 * Returns NULL on error.
44 */
45 symbol_table_t* load_symbol_table(const char* filename);
46
47 /*
48 * Frees a symbol table.
49 */
50 void free_symbol_table(symbol_table_t* table);
51
52 /*
53 * Finds a symbol associated with an address in the symbol table.
54 * Returns NULL if not found.
55 */
56 const symbol_t* find_symbol(const symbol_table_t* table, uintptr_t addr);
57
58#ifdef __cplusplus
59}
60#endif
61
62#endif // _CORKSCREW_SYMBOL_TABLE_H