debug_line.c File Reference

#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"
Include dependency graph for debug_line.c:

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

Detailed Description

DWARF 2 debug line info creation helper

Remarks:
Copyright 2007 OProfile authors
Read the file COPYING
Author:
Philippe Elie

Definition in file debug_line.c.


Typedef Documentation

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.


Enumeration Type Documentation

enum dw_at
Enumerator:
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.

Enumerator:
DW_CHILDREN_no 
DW_CHILDREN_yes 

Definition at line 79 of file debug_line.c.

enum dw_form
Enumerator:
DW_FORM_data4 

Definition at line 84 of file debug_line.c.

enum dw_tag
Enumerator:
DW_TAG_compile_unit 

Definition at line 65 of file debug_line.c.

enum lne_opcode
Enumerator:
DW_LNE_end_sequence 
DW_LNE_set_address 
DW_LNE_define_file 

Definition at line 59 of file debug_line.c.

enum lns_opcode
Enumerator:
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.


Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static void add_debug_line ( struct growable_buffer b,
struct debug_line_info const *  line,
size_t  nr_entry,
unsigned long  code_addr 
) [static]
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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static ubyte get_special_opcode ( struct debug_line_info const *  line,
unsigned int  last_lineno,
unsigned long  last_vma 
) [static]
int init_debug_line_info ( bfd *  abfd  ) 

Variable Documentation

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().

Initial value:
 {
    -1,
    2,
    0,     
    -1
}

Definition at line 146 of file debug_line.c.

Initial value:
 {
    -1,
    2,
    -1,
    1,  
    1,  
    -5, 
    14,     
    DW_LNS_max_opcode
}

Definition at line 129 of file debug_line.c.

ubyte const standard_opcode_length[DW_LNS_max_opcode-1] [static]
Initial value:
{
    0, 1, 1, 1, 1, 0, 0, 0, 1
}

Definition at line 140 of file debug_line.c.


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1