This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB stub for RAM startup.


Andrew Lunn <andrew@lunn.ch> writes:

> On Tue, Feb 10, 2004 at 09:20:11PM -0800, Ottawa Guy wrote:
> > Hi Jonathan,
> > Thanks for the response. Thanks for pointing out the
> > option.
> > I have few more more question. I am having problem
> > doing single step in command line GDB. Following is
> > what I am doing.
> > 
> > In my application main() function, I call
> > "breakpoint()".Once my programs start up it would hit
> > the breakpoint(), thus starting up my GDBs stub. Now I
> > use the normal gdb client to connect to my target.
> > 
> > linux > sparc-elf-gdb -s helloWorld.out
> > (gdb) target extended-remote /dev/ttyS1
> > Remote debugging using /dev/ttyS1
> > 0x010075f0 in _breakinst ()
> >     at
> > /users/hdewan/ecos/ecos-2.0/packages/language/c/libc/startup/v2_0/src/atexit.cxx:85
> > 85      cyg_libc_invoke_atexit_handlers( void )
> > Current language:  auto; currently c++
> > (gdb) step
> > 
> > As you can see my breakpoint is at 0x010075f0. Is the
> > "step" command suppose to single step in my program?
> 
> Yes, but there is a little problem. GDB knowns nothing about this
> breakpoint. It did not place it there. So it does not known how the
> correctly continue in its own. You need to increment the PC by 4
> before doing the step command and then it should work.

Yes and no. The breakpoint in the breakpoint() function is special in
that GDB is able to detect when that breakpoint has been hit and step
over it properly. But it won't do that for any other "alien"
breakpoints it encounters.

Of course this depends on the CPU handling this correctly,
specifically the __is_breakpoint_function() and __skipinst() functions
must be properly implemented. Maybe the sparc __skipinst() needs
attention.

Also note that step does a source line step. stepi does a single
instruction step, and is probably a better way of testing this
functionality until you know it works.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com      The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]