#include "config.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdio.h>
#include <bfd.h>
#include <limits.h>
#include "opjitconv.h"
#include "jitdump.h"
#include "opagent.h"
#include "op_libiberty.h"
#include "op_growable_buffer.h"
Go to the source code of this file.
Data Structures | |
struct | debug_line_header |
struct | compilation_unit_header |
Typedefs | |
typedef uint32_t | uword |
typedef uint16_t | uhalf |
typedef int32_t | sword |
typedef int16_t | shalf |
typedef uint8_t | ubyte |
typedef int8_t | sbyte |
Enumerations | |
enum | lns_opcode { DW_LNS_copy = 1, DW_LNS_advance_pc, DW_LNS_advance_line, DW_LNS_set_file, DW_LNS_set_column, DW_LNS_negate_stmt, DW_LNS_set_basic_block, DW_LNS_const_add_pc, DW_LNS_fixed_advance_pc, DW_LNS_max_opcode } |
enum | lne_opcode { DW_LNE_end_sequence = 1, DW_LNE_set_address, DW_LNE_define_file } |
enum | dw_tag { DW_TAG_compile_unit = 0x11 } |
enum | dw_at { DW_AT_name = 0x03, DW_AT_stmt_list = 0x10, DW_AT_low_pc, DW_AT_high_pc, DW_AT_language, DW_AT_compdir = 0x1b, DW_AT_producer = 0x25 } |
enum | dw_children { DW_CHILDREN_no, DW_CHILDREN_yes } |
enum | dw_form { DW_FORM_data4 = 0x06 } |
Functions | |
static void | emit_uword (struct growable_buffer *b, uword data) |
static void | emit_string (struct growable_buffer *b, char const *s) |
static void | emit_unsigned_LEB128 (struct growable_buffer *b, unsigned long data) |
static void | emit_signed_LEB128 (struct growable_buffer *b, long data) |
static void | emit_extended_opcode (struct growable_buffer *b, ubyte opcode, void *data, size_t data_len) |
static void | emit_opcode (struct growable_buffer *b, ubyte opcode) |
static void | emit_opcode_signed (struct growable_buffer *b, ubyte opcode, long data) |
static void | emit_opcode_unsigned (struct growable_buffer *b, ubyte opcode, unsigned long data) |
static void | emit_advance_pc (struct growable_buffer *b, unsigned long delta_pc) |
static void | emit_advance_lineno (struct growable_buffer *b, long delta_lineno) |
static void | emit_lne_end_of_sequence (struct growable_buffer *b) |
static void | emit_set_file (struct growable_buffer *b, unsigned long index) |
static void | emit_lne_define_filename (struct growable_buffer *b, char const *filename) |
static void | emit_lne_set_address (struct growable_buffer *b, void const *address) |
static ubyte | get_special_opcode (struct debug_line_info const *line, unsigned int last_lineno, unsigned long last_vma) |
static void | emit_lineno_info (struct growable_buffer *b, struct debug_line_info const *line, size_t nr_entry, unsigned long code_addr) |
static void | add_debug_line (struct growable_buffer *b, struct debug_line_info const *line, size_t nr_entry, unsigned long code_addr) |
static void | add_compilation_unit (struct growable_buffer *b, size_t offset_debug_line) |
static void | create_debug_abbrev (struct growable_buffer *b) |
int | init_debug_line_info (bfd *abfd) |
int | finalize_debug_line_info (bfd *abfd) |
Variables | |
struct debug_line_header | packed |
static struct debug_line_header const | default_debug_line_header |
static ubyte const | standard_opcode_length [DW_LNS_max_opcode-1] |
static struct compilation_unit_header const | default_comp_unit_header |
static struct growable_buffer | b_line |
static struct growable_buffer | b_debug_info |
static struct growable_buffer | b_debug_abbrev |
DWARF 2 debug line info creation helper
Definition in file debug_line.c.
typedef int8_t sbyte |
Definition at line 36 of file debug_line.c.
typedef int16_t shalf |
Definition at line 34 of file debug_line.c.
typedef int32_t sword |
Definition at line 33 of file debug_line.c.
typedef uint8_t ubyte |
Definition at line 35 of file debug_line.c.
typedef uint16_t uhalf |
Definition at line 32 of file debug_line.c.
typedef uint32_t uword |
Definition at line 31 of file debug_line.c.
enum dw_at |
DW_AT_name | |
DW_AT_stmt_list | |
DW_AT_low_pc | |
DW_AT_high_pc | |
DW_AT_language | |
DW_AT_compdir | |
DW_AT_producer |
Definition at line 69 of file debug_line.c.
enum dw_children |
Definition at line 79 of file debug_line.c.
enum dw_form |
Definition at line 84 of file debug_line.c.
enum dw_tag |
Definition at line 65 of file debug_line.c.
enum lne_opcode |
Definition at line 59 of file debug_line.c.
enum lns_opcode |
DW_LNS_copy | |
DW_LNS_advance_pc | |
DW_LNS_advance_line | |
DW_LNS_set_file | |
DW_LNS_set_column | |
DW_LNS_negate_stmt | |
DW_LNS_set_basic_block | |
DW_LNS_const_add_pc | |
DW_LNS_fixed_advance_pc | |
DW_LNS_max_opcode |
Definition at line 42 of file debug_line.c.
static void add_compilation_unit | ( | struct growable_buffer * | b, | |
size_t | offset_debug_line | |||
) | [static] |
Definition at line 407 of file debug_line.c.
References add_data(), emit_unsigned_LEB128(), emit_uword(), growable_buffer::p, compilation_unit_header::pointer_size, growable_buffer::size, compilation_unit_header::total_length, and compilation_unit_header::version.
Referenced by init_debug_line_info().
static void add_debug_line | ( | struct growable_buffer * | b, | |
struct debug_line_info const * | line, | |||
size_t | nr_entry, | |||
unsigned long | code_addr | |||
) | [static] |
Definition at line 374 of file debug_line.c.
References add_data(), emit_lineno_info(), emit_lne_end_of_sequence(), debug_line_header::minimum_instruction_length, growable_buffer::p, debug_line_header::prolog_length, growable_buffer::size, debug_line_header::total_length, and debug_line_header::version.
Referenced by init_debug_line_info().
static void create_debug_abbrev | ( | struct growable_buffer * | b | ) | [static] |
Definition at line 427 of file debug_line.c.
References DW_AT_stmt_list, DW_CHILDREN_yes, DW_FORM_data4, DW_TAG_compile_unit, and emit_unsigned_LEB128().
Referenced by init_debug_line_info().
static void emit_advance_lineno | ( | struct growable_buffer * | b, | |
long | delta_lineno | |||
) | [static] |
Definition at line 237 of file debug_line.c.
References DW_LNS_advance_line, and emit_opcode_signed().
Referenced by emit_lineno_info().
static void emit_advance_pc | ( | struct growable_buffer * | b, | |
unsigned long | delta_pc | |||
) | [static] |
Definition at line 231 of file debug_line.c.
References DW_LNS_advance_pc, and emit_opcode_unsigned().
Referenced by emit_lineno_info().
static void emit_extended_opcode | ( | struct growable_buffer * | b, | |
ubyte | opcode, | |||
void * | data, | |||
size_t | data_len | |||
) | [static] |
Definition at line 199 of file debug_line.c.
References add_data(), and emit_unsigned_LEB128().
Referenced by emit_lne_end_of_sequence(), and emit_lne_set_address().
static void emit_lineno_info | ( | struct growable_buffer * | b, | |
struct debug_line_info const * | line, | |||
size_t | nr_entry, | |||
unsigned long | code_addr | |||
) | [static] |
Definition at line 307 of file debug_line.c.
References DW_LNS_copy, emit_advance_lineno(), emit_advance_pc(), emit_lne_define_filename(), emit_lne_set_address(), emit_opcode(), emit_set_file(), debug_line_info::filename, filename, get_special_opcode(), debug_line_info::lineno, and debug_line_info::vma.
Referenced by add_debug_line().
static void emit_lne_define_filename | ( | struct growable_buffer * | b, | |
char const * | filename | |||
) | [static] |
Definition at line 255 of file debug_line.c.
References add_data(), DW_LNE_define_file, emit_opcode(), emit_string(), and emit_unsigned_LEB128().
Referenced by emit_lineno_info().
static void emit_lne_end_of_sequence | ( | struct growable_buffer * | b | ) | [static] |
Definition at line 243 of file debug_line.c.
References DW_LNE_end_sequence, and emit_extended_opcode().
Referenced by add_debug_line().
static void emit_lne_set_address | ( | struct growable_buffer * | b, | |
void const * | address | |||
) | [static] |
Definition at line 270 of file debug_line.c.
References DW_LNE_set_address, and emit_extended_opcode().
Referenced by emit_lineno_info().
static void emit_opcode | ( | struct growable_buffer * | b, | |
ubyte | opcode | |||
) | [static] |
Definition at line 209 of file debug_line.c.
References add_data().
Referenced by emit_lineno_info(), and emit_lne_define_filename().
static void emit_opcode_signed | ( | struct growable_buffer * | b, | |
ubyte | opcode, | |||
long | data | |||
) | [static] |
Definition at line 215 of file debug_line.c.
References add_data(), and emit_signed_LEB128().
Referenced by emit_advance_lineno().
static void emit_opcode_unsigned | ( | struct growable_buffer * | b, | |
ubyte | opcode, | |||
unsigned long | data | |||
) | [static] |
Definition at line 223 of file debug_line.c.
References add_data(), and emit_unsigned_LEB128().
Referenced by emit_advance_pc(), and emit_set_file().
static void emit_set_file | ( | struct growable_buffer * | b, | |
unsigned long | index | |||
) | [static] |
Definition at line 249 of file debug_line.c.
References DW_LNS_set_file, and emit_opcode_unsigned().
Referenced by emit_lineno_info().
static void emit_signed_LEB128 | ( | struct growable_buffer * | b, | |
long | data | |||
) | [static] |
Definition at line 179 of file debug_line.c.
References add_data().
Referenced by emit_opcode_signed().
static void emit_string | ( | struct growable_buffer * | b, | |
char const * | s | |||
) | [static] |
Definition at line 160 of file debug_line.c.
References add_data().
Referenced by emit_lne_define_filename().
static void emit_unsigned_LEB128 | ( | struct growable_buffer * | b, | |
unsigned long | data | |||
) | [static] |
Definition at line 166 of file debug_line.c.
References add_data().
Referenced by add_compilation_unit(), create_debug_abbrev(), emit_extended_opcode(), emit_lne_define_filename(), and emit_opcode_unsigned().
static void emit_uword | ( | struct growable_buffer * | b, | |
uword | data | |||
) | [static] |
Definition at line 154 of file debug_line.c.
References add_data().
Referenced by add_compilation_unit().
int finalize_debug_line_info | ( | bfd * | abfd | ) |
Definition at line 498 of file debug_line.c.
References b_debug_abbrev, b_debug_info, b_line, options::debug_info, fill_section_content(), free_buffer(), growable_buffer::p, and growable_buffer::size.
Referenced by op_jit_convert().
static ubyte get_special_opcode | ( | struct debug_line_info const * | line, | |
unsigned int | last_lineno, | |||
unsigned long | last_vma | |||
) | [static] |
Definition at line 277 of file debug_line.c.
References debug_line_header::line_base, debug_line_header::line_range, debug_line_info::lineno, debug_line_header::minimum_instruction_length, debug_line_header::opcode_base, and debug_line_info::vma.
Referenced by emit_lineno_info().
int init_debug_line_info | ( | bfd * | abfd | ) |
Definition at line 441 of file debug_line.c.
References add_compilation_unit(), add_debug_line(), b_debug_abbrev, b_debug_info, b_line, jr_code_debug_info::code_addr, create_debug_abbrev(), create_section(), jitentry_debug_line::data, options::debug_info, debug_line_info::filename, init_buffer(), jitentry_debug_line_list, debug_line_info::lineno, jitentry_debug_line::next, jr_code_debug_info::nr_entry, growable_buffer::size, and debug_line_info::vma.
Referenced by op_jit_convert().
struct growable_buffer b_debug_abbrev [static] |
Definition at line 439 of file debug_line.c.
Referenced by finalize_debug_line_info(), and init_debug_line_info().
struct growable_buffer b_debug_info [static] |
Definition at line 438 of file debug_line.c.
Referenced by finalize_debug_line_info(), and init_debug_line_info().
struct growable_buffer b_line [static] |
Definition at line 437 of file debug_line.c.
Referenced by finalize_debug_line_info(), and init_debug_line_info().
struct compilation_unit_header const default_comp_unit_header [static] |
{ -1, 2, 0, -1 }
Definition at line 146 of file debug_line.c.
struct debug_line_header const default_debug_line_header [static] |
{ -1, 2, -1, 1, 1, -5, 14, DW_LNS_max_opcode }
Definition at line 129 of file debug_line.c.
struct compilation_unit_header packed |
ubyte const standard_opcode_length[DW_LNS_max_opcode-1] [static] |
{ 0, 1, 1, 1, 1, 0, 0, 0, 1 }
Definition at line 140 of file debug_line.c.