From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17593 invoked by alias); 13 May 2004 13:37:35 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 17586 invoked from network); 13 May 2004 13:37:34 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 13 May 2004 13:37:34 -0000 Received: from drow by nevyn.them.org with local (Exim 4.33 #1 (Debian)) id 1BOGOp-00065K-2u; Thu, 13 May 2004 09:37:23 -0400 Date: Thu, 13 May 2004 13:37:00 -0000 From: Daniel Jacobowitz To: Hiroshi DOYU Cc: gdb@sources.redhat.com Subject: Re: Where is the contents of target_fetch_registers () Message-ID: <20040513133723.GB23187@nevyn.them.org> Mail-Followup-To: Hiroshi DOYU , gdb@sources.redhat.com References: <20040513185017.6220543b.Hiroshi_DOYU@montavista.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040513185017.6220543b.Hiroshi_DOYU@montavista.co.jp> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-05/txt/msg00082.txt.bz2 On Thu, May 13, 2004 at 06:50:17PM +0900, Hiroshi DOYU wrote: > Hi all, Hello, Hiroshi-san :) > Now I am implementing gdb support on Linux kernel, Hitachi > SH-Mobile3 (SH73180CP01) and found that the following function > seems not to work correctly when compared with other gdb behavior > which work correctly. > # I can get this with "set debug target 1" option in gdb. > (gdb) r > Starting program: /root/a.out > target_acknowledge_created_inferior (103) > target_reported_exec_events_per_exec_call () = 1 > target_wait (-1, status) = 103, status->kind = stopped, signal = SIGTRAP > target_fetch_registers (pc) = a06b5529 0x29556ba0 693463968 This first wait is the shell which GDB invoked to start your program... > target_terminal_init () > target_terminal_inferior () > target_terminal_inferior () > target_resume (-1, continue, 0) > target_wait (-1, status) = 103, status->kind = stopped, signal = SIGTRAP > target_fetch_registers (pc) = a06b5529 0x29556ba0 693463968 This one is the program starging... > target_resume (-1, continue, 0) > target_wait (-1, status) = 103, status->kind = stopped, signal = SIGTRAP And this one is probably the dynamic linker breakpoint. What this means is that GDB will read some memory from the inferior, figure out the list of loaded shared libraries, and then try to read symbol information for them. If this is where GDB is stopping, it probably means that it is either loading the library symbols (this can take a _long_ time) or ran out of memory and crashed. > I guess the following should have appeaer at this line. > > target_fetch_registers (r14) = 34f9ff7b 0x7bfff934 2080373044 > > > I would like to look into the problem which it hang at the above > point but I dont know much about gdb. So could anyone tell me > how to find where is the contents of "target_fetch_registers ()"? > In other words, in Linux, how can gdb get the registers from > kernel? See the -nat file associated with your target. In this case it's sh-linux-nat.c, if I remember right - which isn't in the FSF GDB sources (was never contributed :(). Look for PTRACE_GETREGS or PTRACE_PEEKUSER, which are the two standard mechanisms of reading registers. -- Daniel Jacobowitz