public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Register cache
@ 2001-02-10 14:37 Mark Kettenis
  2001-02-11 12:07 ` Nick Duffek
  2001-02-13 13:38 ` Andrew Cagney
  0 siblings, 2 replies; 16+ messages in thread
From: Mark Kettenis @ 2001-02-10 14:37 UTC (permalink / raw)
  To: gdb; +Cc: eliz

A few days ago Eli proposed the following patch:

   http://sources.redhat.com/ml/gdb-patches/2001-02/msg00140.html

It proposes a new interface to supply a single i387 register to GDB's
internal register cache in addition to the existing interface that
supplies the whole FPU state.

In a perhaps overly pedantic mood, I raised some objections to the
patch.  I would prefer not to add yet another interface, and I
suggested to Eli that he'd simply use the existing interface, to which
he responded that that would implicate violating the
target_fetch_registers() API.  Let me explain:

We have the following comment on target_fetch_registers() in target.h:

   /* Fetch register REGNO, or all regs if regno == -1.  No result.  */

This suggests that target_fetch_registers() will fetch exactly one
register if REGNO != -1.  However, quite a few targets do something
different, that is, they fetch at least register REGNO, but actually
fetch a whole bunch of them.  This probably started with SVR4-ish
systems that have a /proc filesystem.  On those systems it isn't
possible to fetch a single register.  Instead one get a whole bunch
and procfs_fetch_registers() supplies them all to GDB's register
cache.  Comments in procfs.c suggest that this is an optimization; by
caching the whole register set on possibly saves a few system calls in
the future.  Other targets like the modern BSDs and GNU/Linux that
have appropriate ptrace() requests followed this example and do the
same thing.

Is this really a good idea?  I think it is, at least on targets where
getting at the registers is relatively expensive since it involves a
system call.  Therefore I propose to make this "official" and change
the comment on target_fetch_registers() to:

   /* Fetch at least register REGNO, or all regs if REGNO == -1.  */

Another question is whether we should make this behaviour (I mean
having target_fetch_registers() supply all registers it managed to get
in one go) recommended practice.

Mark

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: Register Cache.
@ 2000-08-31  5:50 Peter Reilley
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Reilley @ 2000-08-31  5:50 UTC (permalink / raw)
  To: Steven Johnson, gdb

Those look good to me.   I would like to see a
command that would set the cache state of all
registers with a single command.

Pete.


-----Original Message-----
From: Steven Johnson <sbjohnson@ozemail.com.au>
To: gdb@sources.redhat.com <gdb@sources.redhat.com>
Date: Thursday, August 31, 2000 12:40 AM
Subject: Re: Register Cache.


>I Want to change the way GDB Caches Registers by doing the following:
>
>1. Add a Cache Type entry so that each register can be set (via a gdb
command)
>to be read cached, write cached or no cache. By default it would be
read/write
>cache enabled as is the case now.
>
>2. Add a command to flush GDB's knowledge of the cache.
>
>My Questions are:
>
>1. Does anyone have any input they would like to add to this?
>2. What sort of command should they be maintenance, data or set commands.
>
>I Would like to have commands like this:
>set register-cache $r5 read
>set register-cache $r5 write
>set register-cache $r5 rw
>set register-cache $r5 disabled
>
>and another command
>
>maintenance register-cache flush
>
>This raises another question:
>
>3. How do i look up the $r5 in the command and turn it into a register
number?
>
>I tried finding the code the interprets:
>set $r5=0
>
>to see how it did it, but it's obscure and I couldn't find it.
>
>Steven Johnson.
>

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Wrong PC after external interrupt.
@ 2000-08-24 17:01 Fabrice Gautier
  2000-08-29 18:01 ` Register Cache Steven Johnson
  0 siblings, 1 reply; 16+ messages in thread
From: Fabrice Gautier @ 2000-08-24 17:01 UTC (permalink / raw)
  To: GDB (E-mail)

Hi,

Sometime (means: too often) when I interrupt my running program with GDB,
the instruction pointer is not aligned on an assembler instruction but one
byte too far. So when I try to step after that I often get a SIGILL or a
SIGSEGV.

Example: Running an eCos program, the target is i386-elf, and I'm using
insight under Cygwin.

Console output:
================
Init device '/dev/ttydiag'
Init tty channel: 77D78
Init device '/dev/haldiag'
HAL/diag SERIAL init

Breakpoint 3, main () at main.c:22  
0x63c55 in Cyg_RealTimeClock::dsr (vector=32, count=0, data=590112) at
//E/cvswork/ecos/packages/kernel/current/src/common/clock.cxx:913

Program received signal SIGILL, Illegal instruction.
0x63c55 in Cyg_RealTimeClock::dsr (vector=32, count=0, data=590112) at
//E/cvswork/ecos/packages/kernel/current/src/common/clock.cxx:913
================

When I disassemble the Cyg_RealTimeClock::dsr function i have:
==============================
Dump of assembler code for function dsr__17Cyg_RealTimeClockUiUiUi:
0x63c40 <dsr__17Cyg_RealTimeClockUiUiUi>:	push   %ebp
0x63c41 <dsr__17Cyg_RealTimeClockUiUiUi+1>:	mov    %esp,%ebp
0x63c43 <dsr__17Cyg_RealTimeClockUiUiUi+3>:	sub    $0x8,%esp
0x63c46 <dsr__17Cyg_RealTimeClockUiUiUi+6>:	add    $0xfffffff8,%esp
0x63c49 <dsr__17Cyg_RealTimeClockUiUiUi+9>:	pushl  0xc(%ebp)
0x63c4c <dsr__17Cyg_RealTimeClockUiUiUi+12>:	pushl  0x10(%ebp)
0x63c4f <dsr__17Cyg_RealTimeClockUiUiUi+15>:	call   0x63804
<tick__11Cyg_CounterUi>
0x63c54 <dsr__17Cyg_RealTimeClockUiUiUi+20>:	add    $0xfffffff4,%esp
0x63c57 <dsr__17Cyg_RealTimeClockUiUiUi+23>:	push   $0x89f40
0x63c5c <dsr__17Cyg_RealTimeClockUiUiUi+28>:	call   0x5f3d8
<timeslice__28Cyg_Scheduler_Implementation>
0x63c61 <dsr__17Cyg_RealTimeClockUiUiUi+33>:	leave  
0x63c62 <dsr__17Cyg_RealTimeClockUiUiUi+34>:	ret    
End of assembler dump.
========================

So you see that the program should have been stopped on 0x63c54 and not
0x63c55

I've experienced many times this problem with eCos. I know at least another
person that have the same symptom (SIGILL or SIGSEGV when Continuing an
interrupted program) with linux.


Thanks

-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2001-03-29 16:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-10 14:37 Register cache Mark Kettenis
2001-02-11 12:07 ` Nick Duffek
2001-02-11 23:26   ` Eli Zaretskii
2001-02-12  9:46     ` Nick Duffek
2001-02-12 10:37       ` Eli Zaretskii
2001-02-16 15:21         ` Mark Kettenis
2001-02-17  0:28           ` Eli Zaretskii
2001-02-17  3:19             ` Mark Kettenis
2001-02-13 13:38 ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2000-08-31  5:50 Register Cache Peter Reilley
2000-08-24 17:01 Wrong PC after external interrupt Fabrice Gautier
2000-08-29 18:01 ` Register Cache Steven Johnson
2000-08-30 21:40   ` Steven Johnson
2001-03-26  6:46   ` Andrew Cagney
2001-03-26  7:22     ` Fernando Nasser
     [not found]       ` <3ABFD062.17EDADAF@neurizon.net>
2001-03-29 16:27         ` Andrew Cagney
2001-03-29 16:27         ` Fernando Nasser

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).