From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25153 invoked by alias); 12 Oct 2006 07:14:55 -0000 Received: (qmail 25132 invoked by uid 22791); 12 Oct 2006 07:14:53 -0000 X-Spam-Check-By: sourceware.org Received: from Unknown (HELO mswbj01.sunnorth.com.cn) (218.247.162.66) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 12 Oct 2006 07:14:49 +0000 Received: from maillog.sunnorth.com.cn (unverified [172.20.10.250]) by mswbj01.sunnorth.com.cn (Clearswift SMTPRS 5.2.5) with ESMTP id ; Thu, 12 Oct 2006 15:16:10 +0800 Received: from ntns1cn.sunnorth.com.cn (ntns1cn.sunnorth.com.cn [172.20.10.252]) by maillog.sunnorth.com.cn (8.12.10/8.12.10) with ESMTP id k9C8SHmQ003957; Thu, 12 Oct 2006 16:28:17 +0800 To: Joel Brobecker Cc: bjgnu@sunnorth.com.cn, gdb@sourceware.org MIME-Version: 1.0 Subject: Re: fail to get ra and bp X-Mailer: Lotus Notes Release 6.5 September 26, 2003 Message-ID: From: ligang@sunnorth.com.cn Date: Thu, 12 Oct 2006 07:14:00 -0000 Content-Type: text/plain; charset="US-ASCII" X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00073.txt.bz2 gdb-owner@sourceware.org wrote on 2006-10-12 13:39:44: > > I am porting GDB to a new target. > > Would you mind telling us what this new target is? I believe this will > greatly help us provide more accurate answers. In the meantime... The new target is named Score ---- 32 bit core designed by Chinese IC company. Both GCC for Score and Binutils for Score have entered GNU main tree just now. In future, GDB for Score is willing to enter GNU official release. > > The prologue has two insns ---- push ra and push bp. > > When back tracing and printing variables, gdb will look for return address > > of this frame and frame pointer on stack. > > Unfortunately, If compiling with -O2, the two insns are probably deleted. > > So, GDB will not get ra and bp value. > > Typical problem. My recommendation, stay away from prologue analysis > as much as you can, because as you know, higher levels of optimization > will break the typical frame layout. What you want, is have this > information provided by the compiler itself and dumped into the > objects in some form. > > One very popular form, at least in the GNU world, is DWARF CFI. There > is also another popular form, which I don't really know much about. > The information is stored in .eh_frame sections. But it essentially > does the same: It tells you how to unwind the call stack. Do you know which target use .eh_frame to handle call stack? Would you please give me more info about .eh_frame or some documents describing it? > This is what you want because this information allows you to avoid > tricky prologue scanning and hairy heuristics to try to guess where > things are. > > Now that I think of it, if you have no choice but do prologue scanning, > you might want to look at a framework that was recently contributed > which should make your task easier. I think it's prologue-value.[hc]. Could I directly call the functions in prologue-value.[hc]? > -- > Joel