From owner-freebsd-hackers Mon Nov 18 9:50:39 2002 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 A39DD37B401 for ; Mon, 18 Nov 2002 09:50:38 -0800 (PST) Received: from mail.malarhojden.nu (malarhojden.nu [195.54.99.114]) by mx1.FreeBSD.org (Postfix) with SMTP id 5C54043E8A for ; Mon, 18 Nov 2002 09:50:37 -0800 (PST) (envelope-from daniel@malarhojden.nu) Received: (qmail 9093 invoked by uid 1000); 18 Nov 2002 17:50:35 -0000 Date: Mon, 18 Nov 2002 18:50:35 +0100 From: Daniel Lundqvist To: freebsd-hackers@freebsd.org Subject: stacktrace for running program. Message-ID: <20021118175035.GA86600@malarhojden.nu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, I apologize if this is not the right list for this kind of questions,please point me to a better one that is the case. Now,what I want to do is to generate stack traces from a running program. That is no problem with gcc's __builtin_frame_address function. But I'm having problem getting that to work from a signal handler,in this case for SIGSEGV. Output from test program: bash-2.05b$ ./dump looking up address 0x80488c4 in frame 0xbfbff6a8 looking up address 0xbfbfffac in frame 0xbfbff870 looking up address 0x8048621 in frame 0xbfbff8bc ext Stack: handle_SEGV_ext 0xbfbfffac _start Abort trap (core dumped) address is the return address of previous function called and frame is the stack frame. I generate the SEGV from main. But as you can see I can't get the address of the function that generated the signal/exception/trap. I tried looking into /sys/i386/i386/trap.c to look for hints on how to get the adress where the fault happened,but I was kind of lost :) So my question is,is it possible to find out the address where a fault occured from userspace? Please reply to me directly since I'm not on the list. Thanks in advance, Daniel Lundqvist To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message