public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Fabrice Gautier <Fabrice_Gautier@sdesigns.com>
To: 'Jonathan Larmour' <jlarmour@redhat.co.uk>
Cc: "'Ecos-List (E-mail)'" <ecos-discuss@sourceware.cygnus.com>
Subject: RE: [ECOS] Multi thread Debugging
Date: Thu, 31 Aug 2000 03:56:00 -0000	[thread overview]
Message-ID: <8AE4B526B977D411841F00A0CC334020052C38@cuz-exchange.sdesigns.net> (raw)

Again more thoughts about that.
(Sorry if i'm filling your mailboxes)

> [...]
> If I'm not wrong in anything this means that :
> 
> 1/ The HAL_SavedRegister structure does not contain all the 
> information needed by the debugger. 

> 3/ The get_saved_context function is buggy: when the 
> saved_context member is null (means the thread switch was not 
> caused by an IRQ) it should reconstruct a valid context using 
> stack_ptr. In fact this is the HAL_THREAD_GET_SAVED_REGISTERS 
> macro that is buggy. So this is a i386 specific bug. (Good news!)

I see a problem here. If we want to construct a valid context that can be
returned to the gdb stub, we need some memory. I see only two solutions for
this:

a/ Have a structure in the thread class that can contain this context.
b/ Allocate this structure on the stack just before switching thread - in
addition to the space already used to store the switch context 
c/ Have the same structure for the switch context and the full context, and
so construct the full context at every thread switch.

Providing that I've get it all right since the beginning, here are my though
about implemting such solutions

a/	Up: Is seems easy to implement.
	Downs: require a change for all archs and take extra memory.
b/	Up: Only needs to change i386 code
	Down: Less easy to implement, take extra memory on threads stacks
(but easy to  get rid of this Down when not in debug mode)
c/	Up: Maybe the more logical (same context for interrupt or thread
switch)
	Down: Probably less efficient for thread switching (and not easy to
change this when not in debug mode)


> 4/ The HAL_GET_GDB_REGISTERS macro (in fact the corresponding 
> function) is buggy : it should transmit to gdb the saved 
> context passed as the second argument. A priori another i386 
> pc specific bug (Good news!)

Another soultion could be not to return any context when saved_context is
null and to treat this specific case in the dbg_getthreadreg function. Such
a change would apply to all arch however.

One concern anyway is to know if the problem I experience only occur with
the i386 PC platform. 

For what I see, I think the same problem may occur in any arch where the
thread and interrupt contexts are different.

Thanks

A+

-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 

             reply	other threads:[~2000-08-31  3:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-31  3:56 Fabrice Gautier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-09-01 14:18 Fabrice Gautier
2000-08-31 18:54 Fabrice Gautier
2000-09-01  3:12 ` Nick Garnett
2000-08-31 15:31 Fabrice Gautier
2000-09-01  2:55 ` Nick Garnett
2000-08-30 19:56 Fabrice Gautier
2000-08-31  4:15 ` Nick Garnett
2000-08-30 16:39 Fabrice Gautier
2000-08-25 12:06 Fabrice Gautier
2000-08-25 11:18 Fabrice Gautier
2000-08-25 11:38 ` Jonathan Larmour
2000-08-23 14:53 Fabrice Gautier
2000-08-24  7:17 ` Jonathan Larmour
2000-08-21 19:15 Fabrice Gautier
2000-08-15 12:00 Fabrice Gautier

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=8AE4B526B977D411841F00A0CC334020052C38@cuz-exchange.sdesigns.net \
    --to=fabrice_gautier@sdesigns.com \
    --cc=ecos-discuss@sourceware.cygnus.com \
    --cc=jlarmour@redhat.co.uk \
    /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).