From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: dynlib_addr and stripped dynamic modules Date: Mon, 07 Dec 2015 18:57:46 +0000 Message-ID: References: <83a8q53n8i.fsf@gnu.org> <83oae2ccxu.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1130cd245b30010526536ffa X-Trace: ger.gmane.org 1449514695 31725 80.91.229.3 (7 Dec 2015 18:58:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Dec 2015 18:58:15 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 07 19:58:08 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a60z6-0003UR-El for ged-emacs-devel@m.gmane.org; Mon, 07 Dec 2015 19:58:04 +0100 Original-Received: from localhost ([::1]:56043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a60z5-0003te-R7 for ged-emacs-devel@m.gmane.org; Mon, 07 Dec 2015 13:58:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a60z1-0003tO-Ej for emacs-devel@gnu.org; Mon, 07 Dec 2015 13:58:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a60z0-000537-F1 for emacs-devel@gnu.org; Mon, 07 Dec 2015 13:57:59 -0500 Original-Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:36573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a60yy-00052X-IT; Mon, 07 Dec 2015 13:57:56 -0500 Original-Received: by wmww144 with SMTP id w144so153069111wmw.1; Mon, 07 Dec 2015 10:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=hj29pRPYuKemFx4cwFRG+TZQ2OOIb+aua57ZfnWa5YY=; b=k1su+uDvutUeeg3fU/YSw1C4Oh+oBvXqjdNX8HW4uJmg8nNVm92uN+NOW1tFF5iDHU eoJRIApCWOHoz8am2IxmOmmpICYp1BJyQcH7nd6s+J7vP9764szoQrQi0wvooR2i6sJE x+O7fGzbaa4dimAcC+RtuMtnZV+6Psf9gAYGR3XrRalnVMPmH7PrJ8kUM7bpEWId723A wBO3378WRW/DpbxPW3eVCqoEjgi9mA7XjR7dK5gsRNtf1vxJn+R2a+1+HoE3yw3bJku+ q6PajBof9kAKDIr2hnJnrOq0k5WKJR8+075b83ucVreyBp7XtjnGmZdioQJarafe7UMt ScxQ== X-Received: by 10.194.116.170 with SMTP id jx10mr34169002wjb.166.1449514675939; Mon, 07 Dec 2015 10:57:55 -0800 (PST) In-Reply-To: <83oae2ccxu.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:195964 Archived-At: --001a1130cd245b30010526536ffa Content-Type: text/plain; charset=UTF-8 Eli Zaretskii schrieb am Mo., 7. Dez. 2015 um 19:48 Uhr: > > From: Philipp Stephani > > Date: Mon, 07 Dec 2015 18:37:55 +0000 > > > > Eli Zaretskii schrieb am So., 22. Nov. 2015 um 19:25 Uhr: > > > > Does dynlib_laddr (and its underlying library function dladdr) work > on > > Posix hosts when the module was stripped of any unneeded symbols? > > > > Well written Emacs modules will have all but one of its functions > > static and un-exported, so the only way to access the name of a > > function by its address is to read a symbol table of some kind. Does > > that work with *.so files that were run through "strip > --strip-unneeded"? > > > > Probably not, but I haven't tested it. I've added dladdr because I found > it > > useful for debugging myself and it's easy to implement, and I guess > during > > debugging people will often work with unstripped libraries. > > The information from dynlib_addr is used every time there's a fatal > error in a module, so it's not just for debugging the module by its > author, it's also for users to report when they encounter errors while > using the module. > Sure, but having that info in debug mode is better than nothing. To have reliable function name information, we need to change the interface of make_function to accept a symbol name parameter and have make_function assign the new function to the symbol. That would be fine with me: it makes the interface of make_function even more complex, but it would automatically cover the most common case. --001a1130cd245b30010526536ffa Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Mo., 7. Dez. 2015 um 19:48=C2=A0Uhr:
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Mon, 07 Dec 2015 18:37:55 +0000
>
> Eli Zaretskii <el= iz@gnu.org> schrieb am So., 22. Nov. 2015 um 19:25 Uhr:
>
>=C2=A0 =C2=A0 =C2=A0Does dynlib_laddr (and its underlying library funct= ion dladdr) work on
>=C2=A0 =C2=A0 =C2=A0Posix hosts when the module was stripped of any unn= eeded symbols?
>
>=C2=A0 =C2=A0 =C2=A0Well written Emacs modules will have all but one of= its functions
>=C2=A0 =C2=A0 =C2=A0static and un-exported, so the only way to access t= he name of a
>=C2=A0 =C2=A0 =C2=A0function by its address is to read a symbol table o= f some kind. Does
>=C2=A0 =C2=A0 =C2=A0that work with *.so files that were run through &qu= ot;strip --strip-unneeded"?
>
> Probably not, but I haven't tested it. I've added dladdr becau= se I found it
> useful for debugging myself and it's easy to implement, and I gues= s during
> debugging people will often work with unstripped libraries.

The information from dynlib_addr is used every time there's a fatal
error in a module, so it's not just for debugging the module by its
author, it's also for users to report when they encounter errors while<= br> using the module.

Sure, but having that= info in debug mode is better than nothing.

To hav= e reliable function name information, we need to change the interface of ma= ke_function to accept a symbol name parameter and have make_function assign= the new function to the symbol. That would be fine with me: it makes the i= nterface of make_function even more complex, but it would automatically cov= er the most common case.=C2=A0
--001a1130cd245b30010526536ffa--