[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] GDB with uClinux
Hi Walt,
Sorry for the delay on this - here's a status update.
Basically I've resurrected my patched gdbserver for microblaze/uClinux
support - see attached archive. move your existing user/gdbserver
directory aside, and extract this archive in its place.
The package uses gdbserver's existing GNU configure scripts to configure
- good news there is that it might even work for other arches, but I
haven't tested.
The bad news is that I've only tried it very briefly, and it doesn't
work. It can connect, and basic ops like memory and register queries
seem ok. However, breakpoints and single stepping aren't there yet.
For what it's worth, I expect it's only a couple of errors away from
working, since we have had it going previously on older versions of the
tools and kernel.
I simply haven't had the necessary time recently to spend on this to get
it going, however I can tell you that the issues will almost certainly
reside among any of three places:
- gdbserver app itself.
- arch/microblaze/kernel/ptrace.c
- mb-gdb
The issue with a custom mb-gdb that I mentioned earlier concerns the way
that mb-gdb on the host, instructs the target (gdbserver in this case)
to set a breakpoint. There's a gdb packet type 'x' that is to set a
breakpoint explicitly, but this isn't supported by gdbserver. Instead,
mb-gdb just does a memory write to insert the appropriate breakpoint
instruction. Problem is, originally Xilinx's port of mb-gdb was only
intended to commuicate with their XMD application, so some retrohacks
were required to play nicely with gdbserver.
In principle, what should happen is that mb-gdb sends a memory write
packet that inserts a breakpoint instruction ("brki r17, 0x18" in
mb-uclinux) at the appropriate address. When execution reaches the
instruction it triggers the kernel break/trace trap, and everything
should work as expected.
That's the theory, however the practice is still a little way off.
I seem to recall we got it to the point where we could use a stock
mb-gdb, and have gdbserver do a translation between the mb-gdb's
breakpoint write, and the instruction actually used in the mb-uclinux
kernel. The problem here of course is that if, by chance, the user
wanted to set some memory contents that just happened to be equal to
this "magic word", then gdbserver would silently disobey them. Not very
likely, but nasty enough to avoid.
There's debugging code still enabled in this gdbserver archive, to
display the contents of the gdb communication packets and so on.
So, maybe useful to you, maybe not, but until I get some time to spend
I'm afraid that's about it.
Regards,
John
John Williams wrote:
> Hi Walt,
>
> White, Walt J (GE Infrastructure) wrote:
>
>
>> I wanted to briefly recap and then ask a couple more questions:
>>
>> first, the goal: I'd like to be able to use the XPS software debug
>> environment for debugging my target application running under uClinux
>> on a custom target board.
>
>
> This should be possible - at the very least you may need to start gdb
> from outside the XPS. However, it is possible to use the mb-gdb GUI as
> expected, and in a consistent way.
>
>> what's working: I can cross-compile my target application from a
>> RedHat box and take the output file, 'pImage.romfs', and load it into
>> the target memory via TFTP through a tcpip connection. From here I
>> can execute the application, which generally works as designed so far,
>> such as prints to a console, etc...
>
>
> OK, a good baseline.
>
>> next steps: My understanding is that I need to include your new
>> (alpha or beta mb) gdbserver application as one of my target
>> applications so it can run on the target and connect to the main GDB
>> running under XPS. I also may need to use a tweaked version of the
>> mb-gdb as well.
>
>
> Yes. I looked into this yesterady, I've found my modified copy of the
> gdbserver application, unfortuantely it didn't work straight from thhe
> box. I didn't have enough time to discover why, but I will keep working
> on it.
>
> As for the modified gdb - again I have to recheck and confirm. It was
> 12 months ago when we did this work, and so things are a little hazy.
>
> Application debug support is important, and your email has motivated me
> to clean it up once and for all :)
>
>> questions: Will all the source code for the uClinux distribution,
>> along with my application code need to be loaded into a 'software
>> application' project in XPS? Were you able to find out anymore about
>> the tools I'll need? Has anyone else done this successfully yet, and
>> are there any other resources I can tap?
>
>
> Your application will appear to gdb in the same way that it would if you
> where running GDB on a desktop machine. So no, you just debug your
> aplication - you would haev to run two copies of gdb side-by-side, one
> on the app, the other on the kernel, if you want to trace down into the
> kernel. I see no reason why this wouldn't work, if you needed it.
>
> when debugging an application, you can single step through its source
> code, inspect registers, memory, local vars etc. It works mostly how
> you would expect.
>
> If you tried single stepping from the application down into a kernel
> system call, I have no idea what would happen, but it's unlikely to do
> what you expect!
>
> I hope to have something working by the end of next week - stay tuned.
>
> Regards,
>
> John
>
>
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive :
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
--
Dr John Williams, Research Fellow,
Embedded Systems Group / Reconfigurable Computing
School of ITEE, The University of Queensland, Brisbane, Australia
(p) +61 7 33652185 (f) +61 7 33654999 (m) +61 403969243
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/