1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* addr2line.c: apply a patch from shinichiro.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-11-26 04:39:23 +00:00
parent 086301ac73
commit 39e7b2fb94
2 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Fri Nov 26 13:33:24 2010 NARUSE, Yui <naruse@ruby-lang.org>
* addr2line.c: apply a patch from shinichiro.h.
Fri Nov 26 12:21:20 2010 NARUSE, Yui <naruse@ruby-lang.org> Fri Nov 26 12:21:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
* addr2line.c: added to show source filename and line number of * addr2line.c: added to show source filename and line number of

View file

@ -51,11 +51,13 @@
#define DW_LNE_define_file 0x03 #define DW_LNE_define_file 0x03
#define DW_LNE_set_discriminator 0x04 /* DWARF4 */ #define DW_LNE_set_discriminator 0x04 /* DWARF4 */
#ifndef ElfW
# if SIZEOF_VOIDP == 8 # if SIZEOF_VOIDP == 8
# define ElfW(x) Elf64##_##x # define ElfW(x) Elf64##_##x
# else # else
# define ElfW(x) Elf32##_##x # define ElfW(x) Elf32##_##x
# endif # endif
#endif
typedef struct { typedef struct {
const char *dirname; const char *dirname;
@ -210,7 +212,7 @@ parse_debug_line_cu(int num_traces, void **traces,
unsigned int file = 1; unsigned int file = 1;
unsigned int line = 1; unsigned int line = 1;
unsigned int column = 0; unsigned int column = 0;
int is_stmt = default_is_stmt; int is_stmt;
int basic_block = 0; int basic_block = 0;
int end_sequence = 0; int end_sequence = 0;
int prologue_end = 0; int prologue_end = 0;
@ -239,7 +241,7 @@ parse_debug_line_cu(int num_traces, void **traces,
minimum_instruction_length = *(unsigned char *)p; minimum_instruction_length = *(unsigned char *)p;
p++; p++;
default_is_stmt = *(unsigned char *)p; is_stmt = default_is_stmt = *(unsigned char *)p;
p++; p++;
line_base = *(char *)p; line_base = *(char *)p;
@ -489,10 +491,17 @@ rb_dump_backtrace_with_lines(int num_traces, void **trace, char **syms)
binary_filename[len] = '\0'; binary_filename[len] = '\0';
fd = open(binary_filename, O_RDONLY); fd = open(binary_filename, O_RDONLY);
if (fd < 0) {
continue;
}
filesize = lseek(fd, 0, SEEK_END); filesize = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET); lseek(fd, 0, SEEK_SET);
/* async-signal unsafe */ /* async-signal unsafe */
file = (char *)mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0); file = (char *)mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);
if (file == MAP_FAILED) {
perror("mmap");
continue;
}
lines[i].fd = fd; lines[i].fd = fd;
lines[i].mapped = file; lines[i].mapped = file;