public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Where is the contents of target_fetch_registers ()
@ 2004-05-13  9:50 Hiroshi DOYU
  2004-05-13 13:37 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Hiroshi DOYU @ 2004-05-13  9:50 UTC (permalink / raw)
  To: gdb

Hi all,

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 a.out
GNU gdb 6.0 (MontaVista 6.0-8.0.7.0300532 2003-12-24)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sh-hardhat-linux"...
(gdb) list
2	{
3	   int a, b, c;
4	   
5	   a = b + c;
6	}
7	
8	main()
9	{
10		while (1) 
11			func();
(gdb) b func
Breakpoint 1 at 0x400356: file a.c, line 5.
(gdb) set debug target 1
(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
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
target_post_startup_inferior (103)
target_xfer_memory (0x4104f4, xxx, 176, read, xxx) = 176, bytes = 01 00 00 00 01 00 00 00 0c 00 00 00
 e0 01 40 00 0d 00 00 00 80 04 40 00 04 00 00 00
 08 01 40 00 05 00 00 00 58 01 40 00 06 00 00 00
 28 01 40 00 0a 00 00 00 2d 00 00 00 0b 00 00 00
 10 00 00 00 15 00 00 00 00 00 00 00 03 00 00 00
 b8 05 41 00 02 00 00 00 18 00 00 00 14 00 00 00
 07 00 00 00 17 00 00 00 ac 01 40 00 fe ff ff 6f
 8c 01 40 00 ff ff ff 6f 01 00 00 00 f0 ff ff 6f
 86 01 40 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00
target_xfer_memory (0x400356, xxx, 2, read, xxx) = 2, bytes = e1 51
target_xfer_memory (0x400356, xxx, 2, write, xxx) = 2, bytes = c3 c3
target_insert_breakpoint (0x400356, xxx) = 0
target_xfer_memory (0x295613b0, xxx, 2, read, xxx) = 2, bytes = e6 2f
target_xfer_memory (0x295613b0, xxx, 2, write, xxx) = 2, bytes = c3 c3
target_insert_breakpoint (0x295613b0, xxx) = 0
target_terminal_inferior ()
target_resume (-1, continue, 0)
target_wait (-1, status) = 103,   status->kind = stopped, signal = SIGTRAP
target_fetch_registers (pc) = b0135629 0x295613b0 693506992
target_xfer_memory (0x400356, xxx, 2, write, xxx) = 2, bytes = e1 51
target_remove_breakpoint (0x400356, xxx) = 0
target_xfer_memory (0x295613b0, xxx, 2, write, xxx) = 2, bytes = e6 2f
target_remove_breakpoint (0x295613b0, xxx) = 0
target_terminal_ours_for_output ()
target_xfer_memory (0x4104f4, xxx, 176, read, xxx) = 176, bytes = 01 00 00 00
 01 00 00 00 0c 00 00 00 e0 01 40 00 0d 00 00 00
 80 04 40 00 04 00 00 00 08 01 40 00 05 00 00 00
 58 01 40 00 06 00 00 00 28 01 40 00 0a 00 00 00
 2d 00 00 00 0b 00 00 00 10 00 00 00 15 00 00 00
 3c 94 57 29 03 00 00 00 b8 05 41 00 02 00 00 00
 18 00 00 00 14 00 00 00 07 00 00 00 17 00 00 00
 ac 01 40 00 fe ff ff 6f 8c 01 40 00 ff ff ff 6f
 01 00 00 00 f0 ff ff 6f 86 01 40 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00
target_xfer_memory (0x29579440, xxx, 4, read, xxx) = 4, bytes =
 50 94 57 29
target_xfer_memory (0x29579450, xxx, 20, read, xxx) = 20, bytes = 00 00 00 00 f8 69 56 29
 f4 04 41 00 18 99 57 29 00 00 00 00
target_xfer_memory (0x29579918, xxx, 20, read, xxx) = 20, bytes = 00 a0 57 29 08 99 57 29
 bc 20 6a 29 b4 90 57 29 50 94 57 29
target_xfer_memory (0x29579908, xxx, 4, read, xxx) = 4, bytes = 2f 6c 69 62
target_xfer_memory (0x2957990c, xxx, 4, read, xxx) = 4, bytes = 2f 6c 69 62
target_xfer_memory (0x29579910, xxx, 4, read, xxx) = 4, bytes = 63 2e 73 6f
target_xfer_memory (0x29579914, xxx, 4, read, xxx) = 4, bytes = 2e 36 00 00
target_xfer_memory (0x295790b4, xxx, 20, read, xxx) = 20, bytes =
 00 60 55 29 f4 00 40 00 d0 8e 57 29 00 00 00 00
 18 99 57 29
target_xfer_memory (0x4000f4, xxx, 4, read, xxx) = 4, bytes = 2f 6c 69 62
target_xfer_memory (0x4000f8, xxx, 4, read, xxx) = 4, bytes = 2f 6c 64 2d
target_xfer_memory (0x4000fc, xxx, 4, read, xxx) = 4, bytes = 6c 69 6e 75
target_xfer_memory (0x400100, xxx, 4, read, xxx) = 4, bytes = 78 2e 73 6f
target_xfer_memory (0x400104, xxx, 4, read, xxx) = 4, bytes = 2e 32 00 00

	<freeze>


I guess the following should have appeaer at this <freeze> 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?

Any comments will be appriciated.

Thanks,
-doyu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Where is the contents of target_fetch_registers ()
  2004-05-13  9:50 Where is the contents of target_fetch_registers () Hiroshi DOYU
@ 2004-05-13 13:37 ` Daniel Jacobowitz
  2004-05-14  8:47   ` Hiroshi DOYU
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2004-05-13 13:37 UTC (permalink / raw)
  To: Hiroshi DOYU; +Cc: gdb

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 <freeze> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Where is the contents of target_fetch_registers ()
  2004-05-13 13:37 ` Daniel Jacobowitz
@ 2004-05-14  8:47   ` Hiroshi DOYU
  0 siblings, 0 replies; 3+ messages in thread
From: Hiroshi DOYU @ 2004-05-14  8:47 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

On Thu, 13 May 2004 09:37:23 -0400
Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, May 13, 2004 at 06:50:17PM +0900, Hiroshi DOYU wrote:
> > Hi all,
> 
> Hello, Hiroshi-san :)

Hello, Daniel :)
 
> > 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.

What caused the problem is for kernel to run out of memory because 
our glibc includes debug information in it and the size of it is 
more than 20MB. After I stripped libc, gdb works fine.

Thanks for your information.
-doyu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-14  8:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-13  9:50 Where is the contents of target_fetch_registers () Hiroshi DOYU
2004-05-13 13:37 ` Daniel Jacobowitz
2004-05-14  8:47   ` Hiroshi DOYU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).