From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24754 invoked by alias); 31 Oct 2011 21:33:21 -0000 Received: (qmail 24744 invoked by uid 22791); 31 Oct 2011 21:33:20 -0000 X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-pz0-f49.google.com (HELO mail-pz0-f49.google.com) (209.85.210.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 31 Oct 2011 21:33:06 +0000 Received: by pzk32 with SMTP id 32so19418855pzk.8 for ; Mon, 31 Oct 2011 14:33:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.56.165 with SMTP id b5mr25609787pbq.86.1320096785957; Mon, 31 Oct 2011 14:33:05 -0700 (PDT) Received: by 10.68.43.137 with HTTP; Mon, 31 Oct 2011 14:33:05 -0700 (PDT) In-Reply-To: References: <201110311743.03721.pedro@codesourcery.com> Date: Mon, 31 Oct 2011 21:35:00 -0000 Message-ID: Subject: Fwd: How "can't compute CFA for this frame" and "no enough registers or memory available to further unwind" happen? From: zhihua che To: gdb Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2011-10/txt/msg00244.txt.bz2 ---------- Forwarded message ---------- From: zhihua che Date: 2011/11/1 Subject: Re: How "can't compute CFA for this frame" and "no enough registers or memory available to further unwind" happen? To: Pedro Alves 2011/11/1 Pedro Alves : > On Monday 31 October 2011 17:25:46, zhihua che wrote: >> Hi, everyone >> >> =A0 =A0 =A0 =A0I'm not sure this is right place for the help. I'm writin= g a >> toy os and coding with mixed assembly and C language, debugging with >> GDB. But I'm trapped with an annoying problem. This is my situation: >> During the os booting time, after the os control transfers from real >> mode assembly codes to real mode C codes, I wish I can exam the stack >> frames and local variable as I do in regular application program, but >> I always get "can't compute CFA for this frame" or "No enough >> registers or memory available to further unwind" if I issue "print >> xxx" or "backtrace" command respectivelly. > > You'll need to debug gdb. =A0Check what is it that gdb is finding > unavailable. =A0Put a breakpoint at `throw_error' and then do that > "print XXX". =A0You should hit a call like `throw_error (NOT_AVAILABLE_ER= ROR...'. > Get a backtrace. =A0Do "continue" on the top gdb, and see if further > hits appear. =A0GDB has an exception handling mechanism, and that > exception may be thrown more than once during a command run. I've tried debugging the GDB under "print xxx" circumstance, and I find it doesn't satisfy an comparison in dwarf2_frame_cfa() which is like the below: =A0 =A0 =A0if (! frame_unwinder_is(this_frame, &dwarf2_frame_unwinder)) =A0 =A0 =A0 =A0 =A0 error(_("can't compute CFA for this frame")) the frame_unwinder_is() tests if this_frame->unwind is equal with &dwarf2_frame_unwind. And I further find out this_frame->unwind is equal with &sentinel_frame_unwind instead in this situation But I don't know what causes this. I'm really no familiar with GDB internals. > >> The codes seem work, but I >> can only exam registers or memory using "info reg" or "x" command, >> it's way unfriendly and time-consuming. I have searched a lot but >> don't figure out how these happen. I need your help. Thanks. > > What's the output of "info all-registers"? > > -- > Pedro Alves > The out of "info reg" seems Okay. This is the only way I can exam the executing status of my program until so far. Thanks for your suggestions. And if it would help, the following is the compiling options I use. gcc -g -Wall -mregparm=3D3 -march=3Di386 -m32 -mpreferred-stack-boundary=3D2 -fomit-frame-pointer -ffreestanding -fno-toplevel-reorder -fno-strict-aliasing -fno-stack-protector -nostdinc -Ixxx and the link script is like this, SECTIONS { =A0 =A0. =3D 0x0 =A0 =A0.text {*(.text)} =A0 =A0.rodata{*(.rodata)} =A0 =A0.data{*(.data)} =A0 =A0/DISCARD/ : {*(.eh_frame)} } }