public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: jtc@redback.com (J.T. Conklin)
To: malar kavi <malarkavi@yahoo.com>
Cc: gdb@sourceware.cygnus.com
Subject: Re: remote debugging
Date: Thu, 25 Jan 2001 11:46:00 -0000	[thread overview]
Message-ID: <5mlmrzmn3t.fsf@jtc.redback.com> (raw)
In-Reply-To: <20010125132711.2294.qmail@web5504.mail.yahoo.com>

>>>>> "malar" == malar kavi <malarkavi@yahoo.com> writes:
malar>    There are some subroutines like
malar> getDebugChar,putDebugChar,flash_i_cache,memset,
malar> exceptionhandler used in i386-stub.c.How can i write
malar> these subroutines and link with the program?After
malar> linking how should i start the program in the target
malar> machine?How should i establish serial communication
malar> with the target machine?
malar>        I will be really grateful if anybody is able
malar> to get me out of these problems.
malar>             Thanking u in advance.

The getDebugChar() and putDebugChar() functions are simple functions
that you have to supply that interface with some i/o device, usually
a serial port.  They don't have to be sophisticated.  On many of the
targets I've done this on, I've used polled I/O on UART registers.

For the i386-stub, you don't have to worry about flush_i_cache().  On
some processors, you have to flush the instruction (and sometimes the
data) cache before resuming program execution.

Again, memset() is not needed for the i386-stub.  If you were using
one of the sparc stubs (sparc-stub.c or sparclet-stub.c), you would
need to provide a memset() which conforms to Standard (ANSI/ISO) C.
This is actually a bug in those stubs.  They should provide their 
own static implementation, otherwise the user can't put breakpoints
at memset() to find bugs in their own system.

exceptionHandler() is used to install the exception handlers within
the stub in the processor's exception handler table.  In many of my
targets I have a static exception handler table, so I don't install
the exception handlers dynamically.  You are the best person to know
how you want to do this.  The way you allready install exception and/
or interrupt handlers will probably determine how you do the same for
the debugger stub.

The easiest way to establish connection is to add a call to
breakpoint() as soon as your target has initialized enough to do so.
In other words, after you've initialized the hardware to the point 
where your debug channel is up and after you've installed the stub's
exception handler.  When your program hits the breakpoint() call, it
will enter the stub's handle_exception loop.  At that point, you 
simply need to connect to the debugger ('target remote /dev/ttyXX').

Once you've managed that, you might want to make things a little more
sophisticated.  For example, if you had an interrupt driven i/o driver
you could set things up so the stub was entered as soon as a character 
is received.  I recommend that you get a basic polled i/o mechanism 
working first though.

        --jtc

-- 
J.T. Conklin
RedBack Networks

  reply	other threads:[~2001-01-25 11:46 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-25  5:27 malar kavi
2001-01-25 11:46 ` J.T. Conklin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-03-07 13:52 Remote debugging Russell Shaw
2015-03-07 14:09 ` Ofir Cohen
2015-03-08  7:48   ` Russell Shaw
2004-03-22 14:23 luca risso
2004-03-19 17:59 luca risso
2004-03-19 18:43 ` Daniel Jacobowitz
2003-06-13 14:24 remote debugging nak26
2003-06-13  7:50 Brijesh Shukla
2003-06-13 13:28 ` Quality Quorum
2003-03-20  7:45 Patricia Alba
2002-12-12  9:29 Remote Debugging Tim
2002-12-12 10:30 ` Daniel Jacobowitz
2002-07-22  9:35 remote debugging Vinayak P Risbud
2001-01-23 22:23 malar kavi
2001-01-24  6:16 ` Fernando Nasser
2001-01-24 10:52 ` J.T. Conklin
2000-11-30 22:27 Remote Debugging Yu Xuanwei
2000-12-01 11:40 ` Fernando Nasser
2000-11-29 19:52 Yu Xuanwei
2000-11-28  0:59 Remote debugging Yu Xuanwei
2000-08-15 10:13 remote debugging Shaun Jackman
2000-08-15 12:23 ` Fernando Nasser
2000-04-01  0:00 Remote Debugging Timo Ketola
2000-02-23 19:12 ` Andrew Cagney
2000-04-01  0:00   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5mlmrzmn3t.fsf@jtc.redback.com \
    --to=jtc@redback.com \
    --cc=gdb@sourceware.cygnus.com \
    --cc=malarkavi@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).