- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-07-2011 03:19 AM
Hi,
This is not a request for help, but to let you know that I have recently ported GDB to run natively on Linux.
To get the debugger working, you can follow the instructions at:
http://fusion.phys.tue.nl/fpga/doku.php?id=microbl
This means that Microblaze code can be debugged on an FPGA board without the need to use XMD, and also debug programs using all the normal libraries. Threaded debugging also works.
Additionally the kernel needs patching but this is relatively straight forward.
Good luck and happy debugging!
Billy.
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-07-2011 05:56 AM
Hello Billy,
that is nearly what I am looking for. I think most users would like to run gdb on a development pc and use gdbserver on the microblaze system rather than running gdb itself on the microblaze.
Have you used GDB + gdbserver yourself?
Thanks,
Marco
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-18-2011 01:02 PM
Hi Marco,
gdbserver will compile with patch I have provided, however I found it insufficient for large programs which required specific libraries compiled for the microblaze. This led me to make gdb run on the microblaze so that all the libraries for debugging an executable would be loaded automatically.
the default gdb 7.2 should compile gdbserver (just cd to gdb/gdbserver and make from that directory) and try it. i tested compiling and running gdbserver but found the native microblaze much more useful at debugging even if a bit slower.
If you find gdbserver better then please reply with some details as I think loads of people read these pages,
Cheers,
Billy.
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-22-2011 01:18 AM
Hello Billy,
I am using the latest xlnx kernel (2.6.37 stable) and I tried your patch already. There are a few hunks rejected so I didn't spend more time in that as I read onthe Microblaze-linux facebook site that you have created a patch for Michael.
I'll try your kernel and give you feedback regarding debugging using gdbserver.
Thanks,
Marco
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-29-2011 06:09 AM
Hello Billy,
I tried to build gdb native for the Microblaze. I followed the the steps as described in your wiki ( http://fusion.phys.tue.nl/fpga/doku.php?id=microbl
I used your kernel sources; kernel was compiled and is running successfully.
A small thing to your wiki, the link to download is not correct: hhttp://www.ccfe.ac.uk/fpga/d/fpgaworkshop2011/linux-2.6.3
Compling GDB worked nearly as described, replacing ptrace.h did not work for me as PTRACE_GETREGS is not defined in
arch/microblaze/inlcude/asm/ptrace.h, thus I left the original one which is part of the xlnx tool chain.
After that GDB comiled succesfully but it throws errors when running on the target:
# ./gdb_test
Got: 0
Got: 1
Got: 2
Got: 3
Got: 4
Got: 5
Got: 6
Got: 7
Got: 8
Got: 9
#
#
# ./gdb gdb_test
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "microblaze-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/gdb_test...done.
(gdb) run
Starting program: /root/gdb_test
warning: Unable to fetch general register.
warning: Unable to fetch general register.
warning: Unable to fetch general register.
warning: Unable to fetch general registers.
warning: Unable to fetch general register.
warning: Unable to fetch general register.
warning: Unable to fetch general register.
Program received signal SIGILL, Illegal instruction.
warning: Unable to fetch general register.
warning: Unable to fetch general register.
warning: Unable to fetch general register.
0x00000000 in ?? ()
warning: Unable to fetch general register.
(gdb)
Any ideas what is wrong here?
regarding the gdbserver:
It needs to be configured seperatly and the configuration script states that the target is not supported.
The main task of getting gdbserver 7.2 to work is probably to add linux-micorblaze-low.c
Thanks,
Marco
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-31-2011 05:54 AM
Hello Marco and Billy,
I have the same behaviour as Marco when trying to run a server with gdb for microblaze :
warning: Unable to fetch general register.
#0 0x00000000 in ?? ()
Marco did you solved this problem ?
I will let you know if I find why we have this behaviour.
Best regards,
Olivier
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-01-2011 12:39 AM
Hello Olivier,
no I haven't found a solution yet; printf() is what I am using :-(
Did you patch the gdbserver sources from gdb 7.2?
Cheers,
Marco
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-01-2011 02:19 AM
Hi Marco and Olivier,
The SETREGS/GETREGS error is due to the kernel not having the ptrace patch applied (as mentioned at http://fusion.phys.tue.nl/fpga/doku.php?id=microbl
The SIGILL exception is expected, this should dissappear with the kernel patch. The SIGILL happens when a type of branch occurs in user mode. It is key to have the ptrace patch as this is what allows the kernel to stop and continue programs at different points. Without this the kernel cannot stop the program and you get the output you have seen.
It is true I plan to put the ptrace patch into the mainline but it will not happen for probably at least a month for two reasons: 1) i'm very busy, 2) Michal Simek the microblaze kernel maintainer has rightly indicated that it is a large patch that needs to be broken down and has some big changes so will take time to be patched into the mainline kernel.
In the mean time you have 3 options, 1) wait a long time for a mainline patch, 2) use the kernel on http://fusion.phys.tue.nl/fpga/doku.php?id=microbl
But just to say congratulations for getting gdb to run natively on the microblaze, that is a good achievement!
Cheers,
Billy.
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-01-2011 04:14 AM
Hello Marco,
Thanks for your answer. No I didn't use gdb sources but I used
http://www.ccfe.ac.uk/fpga/d/fpgaworkshop2011/linu
to compile and run linux for microblaze with gdb included.
I agree that printf is not the best way but it can help ! However a good debugger is sometime necessary.
If you look at the new Billy's message the solution to our troubles is described.
I will let you know when it works and which one of the 3 solutions I finally applied
I am still fighting to patch the kernel at moment.
Thank you
Olivier
Re: Microblaze Native GDB Debugging
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-07-2011 03:18 AM
Hello Billy and Olivier,
according to this howto the kernel sources are already patched.
I verified it (all hunks are rejected).
So I am wondering why this behavior still occurs when using the kernel from http://www.ccfe.ac.uk/fpga/d/fpgaworkshop2011/linu
Cheers,
Marco











