public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* kernel debugging (KGDB or JTAG)
@ 2011-08-02  8:13 Jan Pohanka
  2011-08-02  9:32 ` Marc Titinger
  2011-08-02 18:04 ` Tomasz Figa
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Pohanka @ 2011-08-02  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

Dear all,

I'd like to ask if anyone has working setup for kernel debugging on arm
target. I have tried two boards (one with at91sam9g20, second with
freescale i.mx27) with Segger j-link and kgdb with similar and not very
useful results. I have Ubuntu 11.04 as development host and latest
codesourcery arm-none-(linux-gnu)eabi toolchain.

Using 2.6.39 I was able to compile the sources with KGDB enabled. I'm also
able to enter kdb terminal and connect with arm-none-eabi-gdb. Setting and
triggering breakpoints works well, but single stepping (which is essential
to me) does not. Here is the example

Breakpoint 1, 0xc00e40d4 in sys_sync () at
/home/honza/_dev/kernel/linux-2.6.39.y/fs/sync.c:190
190	}
(gdb) list
185			ret = err;
186		mutex_unlock(&mapping->host->i_mutex);
187	
188	out:
189		return ret;
190	}
191	EXPORT_SYMBOL(vfs_fsync_range);
192	
193	/**
194	 * vfs_fsync - perform a fsync or fdatasync on a file
(gdb) s
Sending packet: $Hc148#48...Ack
Packet received: OK
Sending packet: $s#73...Ack
Packet received:
warning: Invalid remote reply:

... now gdb hangs forever

Using j-ling JTAG probe from segger I can't start debug session at all.
When JLinkGDBServer connects it resets the board and I'm not able to
resume the execution. I have found e.g. this howto
http://www.timesys.com/embedded-linux/docs/Debug_Linux_kernel_with_a_JTAG_from_Segger
but as I said it is not working for me.

Here is the log from JLinkGDBServer

J-Link connected
Firmware: J-Link ARM V8 compiled Jul  5 2011 20:48:23
Hardware: V8.00
S/N: 58004787

J-Link found 2 JTAG devices, Total IRLen = 8
JTAG ID: 0x07926121 (ARM9)

Connected to 127.0.0.1
Reading all registers
WARNING: Failed to read cacheable memory @ address 0x00000000
Read 4 bytes @ address 0x00000000 (Data = 0x00000000)
Starting target CPU...


Any advice will be greatly appreciated...

with best regards
Jan

-- 
Tato zpr?va byla vytvo?ena p?evratn?m po?tovn?m klientem Opery:
http://www.opera.com/mail/

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

* kernel debugging (KGDB or JTAG)
  2011-08-02  8:13 kernel debugging (KGDB or JTAG) Jan Pohanka
@ 2011-08-02  9:32 ` Marc Titinger
  2011-08-02  9:46   ` Jan Pohanka
  2011-08-02 18:04 ` Tomasz Figa
  1 sibling, 1 reply; 4+ messages in thread
From: Marc Titinger @ 2011-08-02  9:32 UTC (permalink / raw)
  To: linux-arm-kernel




----------------------------------------
> Subject: kernel debugging (KGDB or JTAG)
> To: linux-arm-kernel at lists.infradead.org
> From: xhpohanka at gmail.com
> Date: Tue, 2 Aug 2011 10:13:45 +0200
>
> Dear all,

Hi Jan, 

>
> I'd like to ask if anyone has working setup for kernel debugging on arm
> target. I have tried two boards (one with at91sam9g20, second with
> freescale i.mx27) with Segger j-link and kgdb with similar and not very
> useful results. I have Ubuntu 11.04 as development host and latest
> codesourcery arm-none-(linux-gnu)eabi toolchain.
>
> Using 2.6.39 I was able to compile the sources with KGDB enabled. I'm also
> able to enter kdb terminal and connect with arm-none-eabi-gdb. Setting and
> triggering breakpoints works well, but single stepping (which is essential
> to me) does not. Here is the example

did you select "compile with debug info" in the kernel hacking menu ? 

>
> Breakpoint 1, 0xc00e40d4 in sys_sync () at
> /home/honza/_dev/kernel/linux-2.6.39.y/fs/sync.c:190
> 190 }
> (gdb) list
> 185 ret = err;
> 186 mutex_unlock(&mapping->host->i_mutex);
> 187
> 188 out:
> 189 return ret;
> 190 }
> 191 EXPORT_SYMBOL(vfs_fsync_range);
> 192
> 193 /**
> 194 * vfs_fsync - perform a fsync or fdatasync on a file
> (gdb) s
> Sending packet: $Hc148#48...Ack
> Packet received: OK
> Sending packet: $s#73...Ack
> Packet received:
> warning: Invalid remote reply:
>
> ... now gdb hangs forever
>
> Using j-ling JTAG probe from segger I can't start debug session at all.
> When JLinkGDBServer connects it resets the board and I'm not able to
> resume the execution. I have found e.g. this howto

you must probably pass some option to tell the jtag interface not to issue the TRST signal and any init "pokes" it might do,? if you to attach to a running kernel instead of booting it through jtag. 


Cheers,
Marc. 


> http://www.timesys.com/embedded-linux/docs/Debug_Linux_kernel_with_a_JTAG_from_Segger
> but as I said it is not working for me.
>
> Here is the log from JLinkGDBServer
>
> J-Link connected
> Firmware: J-Link ARM V8 compiled Jul 5 2011 20:48:23
> Hardware: V8.00
> S/N: 58004787
>
> J-Link found 2 JTAG devices, Total IRLen = 8
> JTAG ID: 0x07926121 (ARM9)
>
> Connected to 127.0.0.1
> Reading all registers
> WARNING: Failed to read cacheable memory @ address 0x00000000
> Read 4 bytes @ address 0x00000000 (Data = 0x00000000)
> Starting target CPU...
>
>
> Any advice will be greatly appreciated...
>
> with best regards
> Jan
>
> --
> Tato zpr?va byla vytvo?ena p?evratn?m po?tovn?m klientem Opery:
> http://www.opera.com/mail/
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
 		 	   		  

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

* kernel debugging (KGDB or JTAG)
  2011-08-02  9:32 ` Marc Titinger
@ 2011-08-02  9:46   ` Jan Pohanka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Pohanka @ 2011-08-02  9:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marc,

Dne Tue, 02 Aug 2011 11:32:34 +0200 Marc Titinger <mtittinge@hotmail.com>  
napsal(a):

>
>
>
> ----------------------------------------
>> Subject: kernel debugging (KGDB or JTAG)
>> To: linux-arm-kernel at lists.infradead.org
>> From: xhpohanka at gmail.com
>> Date: Tue, 2 Aug 2011 10:13:45 +0200
>>
>> Dear all,
>
> Hi Jan,
>
>>
>> I'd like to ask if anyone has working setup for kernel debugging on arm
>> target. I have tried two boards (one with at91sam9g20, second with
>> freescale i.mx27) with Segger j-link and kgdb with similar and not very
>> useful results. I have Ubuntu 11.04 as development host and latest
>> codesourcery arm-none-(linux-gnu)eabi toolchain.
>>
>> Using 2.6.39 I was able to compile the sources with KGDB enabled. I'm  
>> also
>> able to enter kdb terminal and connect with arm-none-eabi-gdb. Setting  
>> and
>> triggering breakpoints works well, but single stepping (which is  
>> essential
>> to me) does not. Here is the example
>
> did you select "compile with debug info" in the kernel hacking menu ?

Of course :)

>
>>
>> Breakpoint 1, 0xc00e40d4 in sys_sync () at
>> /home/honza/_dev/kernel/linux-2.6.39.y/fs/sync.c:190
>> 190 }
>> (gdb) list
>> 185 ret = err;
>> 186 mutex_unlock(&mapping->host->i_mutex);
>> 187
>> 188 out:
>> 189 return ret;
>> 190 }
>> 191 EXPORT_SYMBOL(vfs_fsync_range);
>> 192
>> 193 /**
>> 194 * vfs_fsync - perform a fsync or fdatasync on a file
>> (gdb) s
>> Sending packet: $Hc148#48...Ack
>> Packet received: OK
>> Sending packet: $s#73...Ack
>> Packet received:
>> warning: Invalid remote reply:
>>
>> ... now gdb hangs forever
>>
>> Using j-ling JTAG probe from segger I can't start debug session at all.
>> When JLinkGDBServer connects it resets the board and I'm not able to
>> resume the execution. I have found e.g. this howto
>
> you must probably pass some option to tell the jtag interface not to  
> issue the TRST signal and any init "pokes" it might do,  if you to  
> attach to a running kernel instead of booting it through jtag.

I started a thread at segger support forum  
http://segger2.com/index.php?page=Thread&threadID=882, it was stated that  
there is no option to attach only, yet. On the other hand I don't  
understand why the board can't rerun from start (through u-boot etc.).  
Maybe openocd could help here, but I have not got a time to try it, yet.

regards
Jan

>
>
> Cheers,
> Marc.
>
>
>> http://www.timesys.com/embedded-linux/docs/Debug_Linux_kernel_with_a_JTAG_from_Segger
>> but as I said it is not working for me.
>>
>> Here is the log from JLinkGDBServer
>>
>> J-Link connected
>> Firmware: J-Link ARM V8 compiled Jul 5 2011 20:48:23
>> Hardware: V8.00
>> S/N: 58004787
>>
>> J-Link found 2 JTAG devices, Total IRLen = 8
>> JTAG ID: 0x07926121 (ARM9)
>>
>> Connected to 127.0.0.1
>> Reading all registers
>> WARNING: Failed to read cacheable memory @ address 0x00000000
>> Read 4 bytes @ address 0x00000000 (Data = 0x00000000)
>> Starting target CPU...
>>
>>
>> Any advice will be greatly appreciated...
>>
>> with best regards
>> Jan
>>
>> --
>> Tato zpr?va byla vytvo?ena p?evratn?m po?tovn?m klientem Opery:
>> http://www.opera.com/mail/
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>  		 	   		


-- 
Tato zpr?va byla vytvo?ena p?evratn?m po?tovn?m klientem Opery:  
http://www.opera.com/mail/

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

* kernel debugging (KGDB or JTAG)
  2011-08-02  8:13 kernel debugging (KGDB or JTAG) Jan Pohanka
  2011-08-02  9:32 ` Marc Titinger
@ 2011-08-02 18:04 ` Tomasz Figa
  1 sibling, 0 replies; 4+ messages in thread
From: Tomasz Figa @ 2011-08-02 18:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jan,

On Tuesday 02 of August 2011 at 10:13:45, Jan Pohanka wrote:
> Using j-ling JTAG probe from segger I can't start debug session at all.
> When JLinkGDBServer connects it resets the board and I'm not able to
> resume the execution. I have found e.g. this howto
> http://www.timesys.com/embedded-linux/docs/Debug_Linux_kernel_with_a_JTAG_fr
> om_Segger but as I said it is not working for me.
> 
> Here is the log from JLinkGDBServer
> 
> J-Link connected
> Firmware: J-Link ARM V8 compiled Jul  5 2011 20:48:23
> Hardware: V8.00
> S/N: [...]
> 
> J-Link found 2 JTAG devices, Total IRLen = 8
> JTAG ID: 0x07926121 (ARM9)
> 
> Connected to 127.0.0.1
> Reading all registers
> WARNING: Failed to read cacheable memory @ address 0x00000000
> Read 4 bytes @ address 0x00000000 (Data = 0x00000000)
> Starting target CPU...

It might be irrelevant, but I have successfully used J-Link to debug Linux 
kernel on S3C6410 SoC, containing an ARM1176JZF-s core, using latest beta 
firmware and their GDB server for windows.

The sequence of operations might be important here. I've been doing it in 
following order:
- started GDB server
- powered the board on
- attached GDB client
- issued 'cont' command to proceed to u-boot and continue normal execution

What might be also helpful is to disable all hang checks in kernel debugging 
section, because the kernel would panic with a false positive after pausing 
the operation for some time.

Best regards,
Tom

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

end of thread, other threads:[~2011-08-02 18:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-02  8:13 kernel debugging (KGDB or JTAG) Jan Pohanka
2011-08-02  9:32 ` Marc Titinger
2011-08-02  9:46   ` Jan Pohanka
2011-08-02 18:04 ` Tomasz Figa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox