資源簡介
官網下載的ruby包,centos6.x種yum自帶的版本過低,如果需要安裝ruby相關插件,需要安裝高版本。
代碼片段和文件信息
/**********************************************************************
??addr2line.c?-
??$Author$
??Copyright?(C)?2010?Shinichiro?Hamaji
**********************************************************************/
#include?“ruby/config.h“
#include?“ruby/missing.h“
#include?“addr2line.h“
#include?
#include?
#ifdef?USE_ELF
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#ifdef?__OpenBSD__
#include?
#else
#include?
#endif
/*?Make?alloca?work?the?best?possible?way.??*/
#ifdef?__GNUC__
#?ifndef?alloca
#??define?alloca?__builtin_alloca
#?endif
#else
#?ifdef?HAVE_ALLOCA_H
#??include?
#?else
#??ifdef?_AIX
#pragma?alloca
#??else
#???ifndef?alloca /*?predefined?by?HP?cc?+Olibcalls?*/
void?*alloca();
#???endif
#??endif?/*?AIX?*/
#?endif /*?HAVE_ALLOCA_H?*/
#endif?/*?__GNUC__?*/
#ifdef?HAVE_DLADDR
#?include?
#endif
#define?DW_LNS_copy?????????????????????0x01
#define?DW_LNS_advance_pc???????????????0x02
#define?DW_LNS_advance_line?????????????0x03
#define?DW_LNS_set_file?????????????????0x04
#define?DW_LNS_set_column???????????????0x05
#define?DW_LNS_negate_stmt??????????????0x06
#define?DW_LNS_set_basic_block??????????0x07
#define?DW_LNS_const_add_pc?????????????0x08
#define?DW_LNS_fixed_advance_pc?????????0x09
#define?DW_LNS_set_prologue_end?????????0x0a?/*?DWARF3?*/
#define?DW_LNS_set_epilogue_begin???????0x0b?/*?DWARF3?*/
#define?DW_LNS_set_isa??????????????????0x0c?/*?DWARF3?*/
/*?Line?number?extended?opcode?name.?*/
#define?DW_LNE_end_sequence?????????????0x01
#define?DW_LNE_set_address??????????????0x02
#define?DW_LNE_define_file??????????????0x03
#define?DW_LNE_set_discriminator????????0x04??/*?DWARF4?*/
#ifndef?ElfW
#?if?SIZEOF_VOIDP?==?8
#??define?ElfW(x)?Elf64##_##x
#?else
#??define?ElfW(x)?Elf32##_##x
#?endif
#endif
#ifndef?ELF_ST_TYPE
#?if?SIZEOF_VOIDP?==?8
#??define?ELF_ST_TYPE?ELF64_ST_TYPE
#?else
#??define?ELF_ST_TYPE?ELF32_ST_TYPE
#?endif
#endif
#ifndef?PATH_MAX
#define?PATH_MAX?4096
#endif
int?kprintf(const?char?*fmt?...);
typedef?struct?{
????const?char?*dirname;
????const?char?*filename;
????const?char?*path;?/*?object?path?*/
????int?line;
????uintptr_t?base_addr;
????uintptr_t?saddr;
????const?char?*sname;?/*?function?name?*/
}?line_info_t;
typedef?struct?obj_info?obj_info_t;
struct?obj_info?{
????const?char?*path;?/*?object?path?*/
????int?fd;
????void?*mapped;
????size_t?mapped_size;
????uintptr_t?base_addr;
????obj_info_t?*next;
};
/*?Avoid?consuming?stack?as?this?module?may?be?used?from?signal?handler?*/
static?char?binary_filename[PATH_MAX];
static?unsigned?long
uleb128(char?**p)
{
????unsigned?long?r?=?0;
????int?s?=?0;
????for?(;;)?{
unsigned?char?b?=?*(unsigned?char?*)(*p)++;
if?(b?0x80)?{
????r?+=?(unsigned?long)b?< ????break;
}
r?+=?(b?&?0x7f)?< s?+=?7;
????}
????return?r;
}
static?lo
評論
共有 條評論