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

ruby-changes:33339

From: naruse <ko1@a...>
Date: Wed, 26 Mar 2014 09:02:31 +0900 (JST)
Subject: [ruby-changes:33339] naruse:r45418 (trunk): don't write _start as is; use dlsym

naruse	2014-03-26 09:02:24 +0900 (Wed, 26 Mar 2014)

  New Revision: 45418

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

  Log:
    don't write _start as is; use dlsym

  Modified files:
    trunk/addr2line.c
Index: addr2line.c
===================================================================
--- addr2line.c	(revision 45417)
+++ addr2line.c	(revision 45418)
@@ -640,9 +640,10 @@ rb_dump_backtrace_with_lines(int num_tra https://github.com/ruby/ruby/blob/trunk/addr2line.c#L640
     intptr_t main_fbase;
     char *main_path;
     {
-	extern void _start(void); /* a function in the main executalbe */
 	Dl_info info;
-	dladdr(_start, &info);
+	void *handle = dlopen(NULL, RTLD_LAZY);
+	void *sym = dlsym(handle, "_start");
+	dladdr(sym, &info);
 	main_fbase = (intptr_t)info.dli_fbase;
     }
     {

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

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