Blame winpr/libwinpr/utils/corkscrew/symbol_table.h
|
Packit |
1fb8d4 |
/*
|
|
Packit |
1fb8d4 |
* Copyright (C) 2011 The Android Open Source Project
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
Packit |
1fb8d4 |
* you may not use this file except in compliance with the License.
|
|
Packit |
1fb8d4 |
* You may obtain a copy of the License at
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
1fb8d4 |
*
|
|
Packit |
1fb8d4 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
1fb8d4 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
1fb8d4 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
1fb8d4 |
* See the License for the specific language governing permissions and
|
|
Packit |
1fb8d4 |
* limitations under the License.
|
|
Packit |
1fb8d4 |
*/
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifndef _CORKSCREW_SYMBOL_TABLE_H
|
|
Packit |
1fb8d4 |
#define _CORKSCREW_SYMBOL_TABLE_H
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#include <stdint.h>
|
|
Packit |
1fb8d4 |
#include <sys/types.h>
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifdef __cplusplus
|
|
Packit Service |
5a9772 |
extern "C"
|
|
Packit Service |
5a9772 |
{
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
|
|
Packit Service |
5a9772 |
typedef struct
|
|
Packit Service |
5a9772 |
{
|
|
Packit Service |
5a9772 |
uintptr_t start;
|
|
Packit Service |
5a9772 |
uintptr_t end;
|
|
Packit Service |
5a9772 |
char* name;
|
|
Packit Service |
5a9772 |
} symbol_t;
|
|
Packit Service |
5a9772 |
|
|
Packit Service |
5a9772 |
typedef struct
|
|
Packit Service |
5a9772 |
{
|
|
Packit Service |
5a9772 |
symbol_t* symbols;
|
|
Packit Service |
5a9772 |
size_t num_symbols;
|
|
Packit Service |
5a9772 |
} symbol_table_t;
|
|
Packit Service |
5a9772 |
|
|
Packit Service |
5a9772 |
/*
|
|
Packit Service |
5a9772 |
* Loads a symbol table from a given file.
|
|
Packit Service |
5a9772 |
* Returns NULL on error.
|
|
Packit Service |
5a9772 |
*/
|
|
Packit Service |
5a9772 |
symbol_table_t* load_symbol_table(const char* filename);
|
|
Packit Service |
5a9772 |
|
|
Packit Service |
5a9772 |
/*
|
|
Packit Service |
5a9772 |
* Frees a symbol table.
|
|
Packit Service |
5a9772 |
*/
|
|
Packit Service |
5a9772 |
void free_symbol_table(symbol_table_t* table);
|
|
Packit Service |
5a9772 |
|
|
Packit Service |
5a9772 |
/*
|
|
Packit Service |
5a9772 |
* Finds a symbol associated with an address in the symbol table.
|
|
Packit Service |
5a9772 |
* Returns NULL if not found.
|
|
Packit Service |
5a9772 |
*/
|
|
Packit Service |
5a9772 |
const symbol_t* find_symbol(const symbol_table_t* table, uintptr_t addr);
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#ifdef __cplusplus
|
|
Packit |
1fb8d4 |
}
|
|
Packit |
1fb8d4 |
#endif
|
|
Packit |
1fb8d4 |
|
|
Packit |
1fb8d4 |
#endif // _CORKSCREW_SYMBOL_TABLE_H
|