|
Packit |
cdaae3 |
/*
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
Copyright (C) 2014-2014 David Anderson. All Rights Reserved.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
This program is free software; you can redistribute it and/or modify it
|
|
Packit |
cdaae3 |
under the terms of version 2.1 of the GNU Lesser General Public License
|
|
Packit |
cdaae3 |
as published by the Free Software Foundation.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
This program is distributed in the hope that it would be useful, but
|
|
Packit |
cdaae3 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
cdaae3 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
Further, this software is distributed without any warranty that it is
|
|
Packit |
cdaae3 |
free of the rightful claim of any third person regarding infringement
|
|
Packit |
cdaae3 |
or the like. Any license provided herein, whether implied or
|
|
Packit |
cdaae3 |
otherwise, applies only to this software file. Patent licenses, if
|
|
Packit |
cdaae3 |
any, provided herein do not apply to combinations of this program with
|
|
Packit |
cdaae3 |
other software, or any other product whatsoever.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
cdaae3 |
License along with this program; if not, write the Free Software
|
|
Packit |
cdaae3 |
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
|
|
Packit |
cdaae3 |
USA.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
*/
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
/* The following is based on
|
|
Packit |
cdaae3 |
The gdb online documentation at
|
|
Packit |
cdaae3 |
https://sourceware.org/gdb/onlinedocs/gdb/
|
|
Packit |
cdaae3 |
Appendix J, ".gdb_index section format".
|
|
Packit |
cdaae3 |
*/
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
/* These are the two types .gdb_index uses.
|
|
Packit |
cdaae3 |
the offset_type (32 bits) and other fields
|
|
Packit |
cdaae3 |
defined 64 bits. We use our own Dwarf_Unsigned
|
|
Packit |
cdaae3 |
for all the interfaces, these are just for reading
|
|
Packit |
cdaae3 |
the section data.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
The section data is defined to be in little-endian regardless of
|
|
Packit |
cdaae3 |
the target machine.
|
|
Packit |
cdaae3 |
We use our host endianness in all interfaces.
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
We simply assume unsigned int is 32 bits FIXME.
|
|
Packit |
cdaae3 |
*/
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
typedef __uint32_t gdbindex_offset_type;
|
|
Packit |
cdaae3 |
typedef Dwarf_Unsigned gdbindex_64;
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
enum gdbindex_type_e {
|
|
Packit |
cdaae3 |
git_unknown,
|
|
Packit |
cdaae3 |
git_std,
|
|
Packit |
cdaae3 |
git_address,
|
|
Packit |
cdaae3 |
git_cuvec
|
|
Packit |
cdaae3 |
};
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
struct Dwarf_Gdbindex_array_instance_s {
|
|
Packit |
cdaae3 |
Dwarf_Small * dg_base;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned dg_count;
|
|
Packit |
cdaae3 |
/* the in_object struct size. */
|
|
Packit |
cdaae3 |
Dwarf_Unsigned dg_entry_length;
|
|
Packit |
cdaae3 |
/* The size of a single field in the in-object struct */
|
|
Packit |
cdaae3 |
int dg_fieldlen;
|
|
Packit |
cdaae3 |
/* The address_area type is a bit irregular. */
|
|
Packit |
cdaae3 |
enum gdbindex_type_e dg_type;
|
|
Packit |
cdaae3 |
};
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
struct Dwarf_Gdbindex_s {
|
|
Packit |
cdaae3 |
Dwarf_Debug gi_dbg;
|
|
Packit |
cdaae3 |
Dwarf_Small * gi_section_data;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned gi_section_length;
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
Dwarf_Unsigned gi_version;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned gi_cu_list_offset;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned gi_types_cu_list_offset;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned gi_address_area_offset;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned gi_symbol_table_offset;
|
|
Packit |
cdaae3 |
Dwarf_Unsigned gi_constant_pool_offset;
|
|
Packit |
cdaae3 |
struct Dwarf_Gdbindex_array_instance_s gi_culisthdr;
|
|
Packit |
cdaae3 |
struct Dwarf_Gdbindex_array_instance_s gi_typesculisthdr;
|
|
Packit |
cdaae3 |
struct Dwarf_Gdbindex_array_instance_s gi_addressareahdr;
|
|
Packit |
cdaae3 |
struct Dwarf_Gdbindex_array_instance_s gi_symboltablehdr;
|
|
Packit |
cdaae3 |
struct Dwarf_Gdbindex_array_instance_s gi_cuvectorhdr;
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
Dwarf_Small * gi_string_pool;
|
|
Packit |
cdaae3 |
};
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|
|
Packit |
cdaae3 |
|