From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 19 16:59:50 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D23E816A420 for ; Sun, 19 Feb 2006 16:59:50 +0000 (GMT) (envelope-from bachi@te-clan.ch) Received: from te-clan.ch (ns1.te-clan.ch [217.118.194.40]) by mx1.FreeBSD.org (Postfix) with SMTP id 1AE0643D45 for ; Sun, 19 Feb 2006 16:59:49 +0000 (GMT) (envelope-from bachi@te-clan.ch) Received: (qmail 35648 invoked from network); 19 Feb 2006 16:58:54 -0000 Received: from unknown (HELO ?10.0.0.241?) (80.219.57.164) by te-clan.ch with SMTP; 19 Feb 2006 16:58:54 -0000 From: Andreas Bachmann To: hackers@freebsd.org Content-Type: text/plain Date: Sun, 19 Feb 2006 17:59:47 +0100 Message-Id: <1140368387.28785.63.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Subject: dladdr in executable and shared object X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Feb 2006 16:59:51 -0000 Hello! Want to have a runtime stacktrace like in a java environment. Why will dladdr get an incorrect dli_fname, when I execute a standalone (without shared object) program? http://bachi.te-clan.ch/freebsd/i386-freebsd-backtrace.c http://bachi.te-clan.ch/freebsd/i386-freebsd-backtrace.result When I create a shared object and link it with a executable, all functions in the shared object will be resolved, but all other functions will get an incorrect result. http://bachi.te-clan.ch/freebsd/i386-freebsd-backtrace-lib.c http://bachi.te-clan.ch/freebsd/i386-freebsd-backtrace-load.c http://bachi.te-clan.ch/freebsd/i386-freebsd-backtrace-lib.result In solaris also standalone programs will get correct dli_fname... http://bachi.te-clan.ch/freebsd/sparc-solaris-backtrace.c http://bachi.te-clan.ch/freebsd/sparc-solaris-backtrace.result I think the whole dynamic linking functions are buggy. dlsym will also not work. http://bachi.te-clan.ch/freebsd/i386-freebsd-dlsym.c http://bachi.te-clan.ch/freebsd/i386-freebsd-dlsym.result Is this a gap and will be implemented/fixed? Are there other functions to translate addresses to symbols on runtime? greets Andreas