[前][次][番号順一覧][スレッド一覧]

ruby-changes:33342

From: naruse <ko1@a...>
Date: Wed, 26 Mar 2014 10:38:10 +0900 (JST)
Subject: [ruby-changes:33342] naruse:r45421 (trunk): * addr2line.c (fill_line): pass and use offset instead of

naruse	2014-03-26 10:38:05 +0900 (Wed, 26 Mar 2014)

  New Revision: 45421

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45421

  Log:
    * addr2line.c (fill_line): pass and use offset instead of
      curobj_baseaddr.

  Modified files:
    trunk/ChangeLog
    trunk/addr2line.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45420)
+++ ChangeLog	(revision 45421)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Mar 26 10:34:25 2014  NARUSE, Yui  <naruse@r...>
+
+	* addr2line.c (fill_line): pass and use offset instead of
+	  curobj_baseaddr.
+
 Wed Mar 26 09:07:48 2014  Yutaka Kanemoto  <kanemoto@r...>
 
 	* configure.in: add --disable-pie. [Feature #9673]
Index: addr2line.c
===================================================================
--- addr2line.c	(revision 45420)
+++ addr2line.c	(revision 45421)
@@ -118,7 +118,6 @@ typedef struct { https://github.com/ruby/ruby/blob/trunk/addr2line.c#L118
 
 /* Avoid consuming stack as this module may be used from signal handler */
 static char binary_filename[PATH_MAX];
-static intptr_t curobj_baseaddr;
 
 static unsigned long
 uleb128(char **p)
@@ -231,11 +230,11 @@ get_path_from_symbol(const char *symbol, https://github.com/ruby/ruby/blob/trunk/addr2line.c#L230
 static void
 fill_line(int num_traces, void **traces,
 	  intptr_t addr, int file, int line,
-	  char *include_directories, char *filenames, line_info_t *lines)
+	  char *include_directories, char *filenames, line_info_t *lines, int offset)
 {
     int i;
-    addr += curobj_baseaddr;
-    for (i = 0; i < num_traces; i++) {
+    addr += lines[offset].base_addr;
+    for (i = offset; i < num_traces; i++) {
 	intptr_t a = (intptr_t)traces[i];
 	/* We assume one line code doesn't result >100 bytes of native code.
        We may want more reliable way eventually... */
@@ -248,7 +247,7 @@ fill_line(int num_traces, void **traces, https://github.com/ruby/ruby/blob/trunk/addr2line.c#L247
 
 static void
 parse_debug_line_cu(int num_traces, void **traces,
-		    char **debug_line, line_info_t *lines)
+		    char **debug_line, line_info_t *lines, int offset)
 {
     char *p, *cu_end, *cu_start, *include_directories, *filenames;
     unsigned long unit_length;
@@ -322,7 +321,7 @@ parse_debug_line_cu(int num_traces, void https://github.com/ruby/ruby/blob/trunk/addr2line.c#L321
 #define FILL_LINE()						    \
     do {							    \
 	fill_line(num_traces, traces, addr, file, line,		    \
-		  include_directories, filenames, lines);	    \
+		  include_directories, filenames, lines, offset);	    \
 	/*basic_block = prologue_end = epilogue_begin = 0;*/	    \
     } while (0)
 
@@ -421,11 +420,11 @@ parse_debug_line_cu(int num_traces, void https://github.com/ruby/ruby/blob/trunk/addr2line.c#L420
 
 static void
 parse_debug_line(int num_traces, void **traces,
-		 char *debug_line, unsigned long size, line_info_t *lines)
+		 char *debug_line, unsigned long size, line_info_t *lines, int offset)
 {
     char *debug_line_end = debug_line + size;
     while (debug_line < debug_line_end) {
-	parse_debug_line_cu(num_traces, traces, &debug_line, lines);
+	parse_debug_line_cu(num_traces, traces, &debug_line, lines, offset);
     }
     if (debug_line != debug_line_end) {
 	kprintf("Unexpected size of .debug_line in %s\n",
@@ -610,7 +609,7 @@ fill_lines(int num_traces, void **traces https://github.com/ruby/ruby/blob/trunk/addr2line.c#L609
     parse_debug_line(num_traces, traces,
 		     file + debug_line_shdr->sh_offset,
 		     debug_line_shdr->sh_size,
-		     lines);
+		     lines, offset);
 finish:
     for (i = offset; i < num_traces; i++) {
 	if (lines[i].line == -1) {
@@ -700,7 +699,6 @@ rb_dump_backtrace_with_lines(int num_tra https://github.com/ruby/ruby/blob/trunk/addr2line.c#L699
 	strncpy(binary_filename, path, len);
 	binary_filename[len] = '\0';
 
-	curobj_baseaddr = lines[i].base_addr;
 	fill_lines(num_traces, traces, syms, 1, &lines[i], lines, i);
     }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]