From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7386 invoked by alias); 12 Jun 2010 13:06:16 -0000 Received: (qmail 7378 invoked by uid 22791); 12 Jun 2010 13:06:16 -0000 X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from caibbdcaaaaf.dreamhost.com (HELO spaceymail-a6.g.dreamhost.com) (208.113.200.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 12 Jun 2010 13:06:12 +0000 Received: from redwood.eagercon.com (c-67-188-233-141.hsd1.ca.comcast.net [67.188.233.141]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by spaceymail-a6.g.dreamhost.com (Postfix) with ESMTP id 9FE94CA74A for ; Sat, 12 Jun 2010 06:06:10 -0700 (PDT) Message-ID: <4C138642.2080202@eagerm.com> Date: Sat, 12 Jun 2010 13:06:00 -0000 From: Michael Eager User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: gdb@sourceware.org Subject: Backtrace from kernel to user space in coredump Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00040.txt.bz2 Hi -- I want to be able to generate a backtrace in a core dump from a uClinux kernel routine (say, do_trap() or do_page_fault()) to the user-space routine which caused the trap. The kernel function is called with a pt_regs struct which contains the user regs. One way I thought to do this is to set the $PC and $SP to the value saved in pt_regs and do a "bt". If I try to set the $PC, gdb complains that there is no process, since there are no routines to modify a core file. I can modify gdb to save the registers returned from reading the core file and add routines allow modifying these saved register values. Are there better ways to do this? How have other people handled traces back from kernel to user space? -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077