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]

Re: Difference between CTRLC & BREAK support on GDB stubs


>From: Jonathan Larmour <jlarmour@redhat.com>

> > Could anyone explain the difference between CTRLC and BREAK support
> > in the GDB stubs ?
>
>What is termed "CTRLC" is for when there are no GDB stubs included in your
>application (and I mean the app here, not the ROM). The term "BREAK" is
>used when GDB stubs are included in your app. CTRLC support is the default
>on most targets.


Jonathan, Thanks for your explanations.

I have the GDB stubs actually running. But, everytime that
I press Ctrl-C on the host, the target always stops with the
following message:

-----------------------------------------------------------------
Program received signal SIGTRAP, Trace/breakpoint trap.
cyg_hal_user_break (regs=0x0)
     at
/ecos/ecos-1.3.1/packages/hal/mips/target/v1_3_1/src/plf_misc.c:
189
189             HAL_BREAKPOINT(breakinst);

--------------------------------------------------------------------

I'd like to have it stopped at the current instruction.

I am thinking that I should change cyg_hal_user_break(), replacing the 
HAL_BREAKPOINT(breakinst) call with

        if( 3 == c )
        {
            // Ctrl-C: set a breakpoint at PC so GDB will display the
            // correct program context when stopping rather than the
            // interrupt handler.
            cyg_hal_gdb_interrupt (pc);
        }

as done in many implementations of the "BREAK" functionality.

The "pc" parameter would be get from
   struct Hal_SavedRegisters *hal_saved_interrupt_state;
global pointer.

One problem that I'm facing is that cyg_hal_gdb_interrupt(),
defined in hal/common/version/src/hal_stub.c, is turned on
when #ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT is enabled.

So, the question is:

a) How do I make my target to stop on the current instruction
that it is running, at the moment of the Ctrl-C ?

b) It is possible to use cyg_hal_gdb_interrupt() when "BREAK" is
disable ?. Am I on the right track here ???

>
> > I have been assigned to do this for a MIPS target, and I've noticed that
> > none of the MIPS based targets in Ecos 1.3.1, have "BREAK" support.
> > Any special reason for that ?.
>
>Yes, for the MIPS HAL, CTRLC and BREAK support is shared - there are not
>separate implementations. Look at the CDL option
>CYGDBG_HAL_MIPS_DEBUG_GDB_CTRLC_SUPPORT in
>hal/mips/arch/VERSION/cdl/hal_mips.cdl.
>

Ok. I'll look at it, again. :-)


>There used to be a bigger difference in how the two forms are implemented,
>but there's very little distinction now in general.
>

I noticed that.


> > I am looking at one of the "ARM" targets and I'll be copying the code to 
>my
> > target, except for the specific serial port initialization. Any 
>potential
> > problem that I am overlooking ?
>
>The ARM HAL and the MIPS HAL are very different in design. I'm not sure
>that copying ARM platform HAL code over to a MIPS platform HAL is the right
>way to approach this.


I meant to say, "copy the design ideas" not the code. I know the
code is very different. Thanks anyway for warning me. :-).


>
>For new work, you may want to consider using anonymous CVS - the virtual
>vector support is very relevant to this area of HALs (ctrl-c etc.), but is
>only present in anon CVS.


We are going to be looking at this soon, when the time comes to
upgrade to RedBoot.


Thanks a lot for your help.
Rosimildo.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


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