public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: "Info reg doesn't work"
       [not found] <KAEHILJLFHMPJPLKAFBHAEDFCBAA.xinan@tidalnetworks.net>
@ 2004-06-16  1:53 ` Jim Blandy
  2004-07-16 21:46   ` "which function is called when updating a register?" Xinan Tang
  0 siblings, 1 reply; 15+ messages in thread
From: Jim Blandy @ 2004-06-16  1:53 UTC (permalink / raw)
  To: Xinan Tang; +Cc: gdb


"Xinan Tang" <xinan@tidalnetworks.net> writes:
>   I don't know what protocol. I use the sim target under gdb:
> 
> > target sim

Then the code in gdb/remote-sim.c would be a good thing to look at.
In particular, are the right values coming through
gdbsim_fetch_register and gdbsim_store_register?

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

* "which function is called when updating a register?"
  2004-06-16  1:53 ` "Info reg doesn't work" Jim Blandy
@ 2004-07-16 21:46   ` Xinan Tang
  2004-07-18 20:38     ` Andrew Cagney
  0 siblings, 1 reply; 15+ messages in thread
From: Xinan Tang @ 2004-07-16 21:46 UTC (permalink / raw)
  To: gdb

Hi

  I set breakpoints on both:

	-- gdbsim_fetch_register and
      -- gdbsim_store_register

  when single stepping the instruction execution, I noticed that
gdbsim_fetech_register was called but gdbsim_store_register.

  Which function is actually called to update a register content within gdb
using a built-in simulator?

Thanks

--Xinan
__________________________________________________
"Xinan Tang" <xinan@tidalnetworks.net> writes:
>
> > target sim

Then the code in gdb/remote-sim.c would be a good thing to look at.
In particular, are the right values coming through
gdbsim_fetch_register and gdbsim_store_register?

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

* Re: "which function is called when updating a register?"
  2004-07-16 21:46   ` "which function is called when updating a register?" Xinan Tang
@ 2004-07-18 20:38     ` Andrew Cagney
  2004-07-19 18:50       ` Xinan Tang
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Cagney @ 2004-07-18 20:38 UTC (permalink / raw)
  To: Xinan Tang; +Cc: gdb

> Hi
> 
>   I set breakpoints on both:
> 
> 	-- gdbsim_fetch_register and
>       -- gdbsim_store_register
> 
>   when single stepping the instruction execution, I noticed that
> gdbsim_fetech_register was called but gdbsim_store_register.
> 
>   Which function is actually called to update a register content within gdb
> using a built-in simulator?

GDB rarely has the need to write to the inferiors registers (if it did 
gdbsim_store_register would be called though).  Try something like:
	set $pc = 0
When the simulator is running a program it updates registers locally and 
directly.

Andrew


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

* RE: "which function is called when updating a register?"
  2004-07-18 20:38     ` Andrew Cagney
@ 2004-07-19 18:50       ` Xinan Tang
  2004-07-19 18:59         ` Andrew Cagney
  0 siblings, 1 reply; 15+ messages in thread
From: Xinan Tang @ 2004-07-19 18:50 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

Hi

  Thanks for the reply.

  My problem is that after I building a new target, I could not see the
registers being updated except PC. For example, after I did "set $sp =
0x80001000", and then "info reg", I still saw $sp is ZERO.

  I am trying to fig out what was wrong with my build. One way to do this is
to trace the simulator execution. However I don't have a clear picture about
the interface between the simulator execution and gdb. For example, which
data structures are read by "info reg" command and which ones are touched by
the simulator. How could GDB get those register content being updated by the
simulator?

Thanks

--Xinan

-----Original Message-----
From: Andrew Cagney [mailto:cagney@gnu.org]
Sent: Sunday, July 18, 2004 11:32 AM
To: Xinan Tang
Cc: gdb@sources.redhat.com
Subject: Re: "which function is called when updating a register?"


> Hi
>
>   I set breakpoints on both:
>
> 	-- gdbsim_fetch_register and
>       -- gdbsim_store_register
>
>   when single stepping the instruction execution, I noticed that
> gdbsim_fetech_register was called but gdbsim_store_register.
>
>   Which function is actually called to update a register content within
gdb
> using a built-in simulator?

GDB rarely has the need to write to the inferiors registers (if it did
gdbsim_store_register would be called though).  Try something like:
	set $pc = 0
When the simulator is running a program it updates registers locally and
directly.

Andrew

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

* Re: "which function is called when updating a register?"
  2004-07-19 18:50       ` Xinan Tang
@ 2004-07-19 18:59         ` Andrew Cagney
  2004-07-21  5:24           ` "Add sim memory region by default" Xinan Tang
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Cagney @ 2004-07-19 18:59 UTC (permalink / raw)
  To: Xinan Tang; +Cc: gdb

> Hi
> 
>   Thanks for the reply.
> 
>   My problem is that after I building a new target, I could not see the
> registers being updated except PC. For example, after I did "set $sp =
> 0x80001000", and then "info reg", I still saw $sp is ZERO.
> 
>   I am trying to fig out what was wrong with my build. One way to do this is
> to trace the simulator execution. However I don't have a clear picture about
> the interface between the simulator execution and gdb. For example, which
> data structures are read by "info reg" command and which ones are touched by
> the simulator. How could GDB get those register content being updated by the
> simulator?

When the inferior (simulator) is resumed, GDB flushes its internal 
register cache (target_registers_changed).  This causes GDB to always 
fetch the latest register values found in the simulator.

Andrew


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

* "Add sim memory region by default"
  2004-07-19 18:59         ` Andrew Cagney
@ 2004-07-21  5:24           ` Xinan Tang
  2004-07-21 15:48             ` Dave Korn
  2004-07-21 19:15             ` "igen based simulators doc.?" Xinan Tang
  0 siblings, 2 replies; 15+ messages in thread
From: Xinan Tang @ 2004-07-21  5:24 UTC (permalink / raw)
  To: gdb


Hi

  Rather than adding a memory region through command of

	"sim memory-region addr,length"

  I would like to add some memory regions permanently within my gdb. Which
source files need to be touched to add a new memory region in GDB?

Thanks

--Xinan

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

* RE: "Add sim memory region by default"
  2004-07-21  5:24           ` "Add sim memory region by default" Xinan Tang
@ 2004-07-21 15:48             ` Dave Korn
  2004-07-21 17:53               ` Xinan Tang
  2004-07-21 19:15             ` "igen based simulators doc.?" Xinan Tang
  1 sibling, 1 reply; 15+ messages in thread
From: Dave Korn @ 2004-07-21 15:48 UTC (permalink / raw)
  To: 'Xinan Tang', gdb

> -----Original Message-----
> From: gdb-owner On Behalf Of Xinan Tang
> Sent: 20 July 2004 23:38

>   Rather than adding a memory region through command of
> 
> 	"sim memory-region addr,length"
> 
>   I would like to add some memory regions permanently within 
> my gdb. Which
> source files need to be touched to add a new memory region in GDB?

  Why not just put a set of "sim memory-region" commands into a .gdbinit
file?  It's just as automatic and effective and a whole lot simpler and more
generic than hardcoding it into the source.


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

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

* RE: "Add sim memory region by default"
  2004-07-21 15:48             ` Dave Korn
@ 2004-07-21 17:53               ` Xinan Tang
  0 siblings, 0 replies; 15+ messages in thread
From: Xinan Tang @ 2004-07-21 17:53 UTC (permalink / raw)
  To: Dave Korn, gdb

Hi

  That is the exact solution we have right now. However this requires each
user coping the .gdbinit file.

  I wonder whether I can hardcode this info into the GDB and do not bother
each user copying anymore.

Thanks

--Xinan

-----Original Message-----
From: Dave Korn [mailto:dk@artimi.com]
Sent: Wednesday, July 21, 2004 5:11 AM
To: 'Xinan Tang'; gdb@sources.redhat.com
Subject: RE: "Add sim memory region by default"


> -----Original Message-----
> From: gdb-owner On Behalf Of Xinan Tang
> Sent: 20 July 2004 23:38

>   Rather than adding a memory region through command of
>
> 	"sim memory-region addr,length"
>
>   I would like to add some memory regions permanently within
> my gdb. Which
> source files need to be touched to add a new memory region in GDB?

  Why not just put a set of "sim memory-region" commands into a .gdbinit
file?  It's just as automatic and effective and a whole lot simpler and more
generic than hardcoding it into the source.


    cheers,
      DaveK
--
Can't think of a witty .sigline today....

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

* "igen based simulators doc.?"
  2004-07-21  5:24           ` "Add sim memory region by default" Xinan Tang
  2004-07-21 15:48             ` Dave Korn
@ 2004-07-21 19:15             ` Xinan Tang
  2004-07-21 20:24               ` "igen vs. cgen?" Xinan Tang
  2004-07-23 19:03               ` "igen based simulators doc.?" Andrew Cagney
  1 sibling, 2 replies; 15+ messages in thread
From: Xinan Tang @ 2004-07-21 19:15 UTC (permalink / raw)
  To: gdb

Hi

  Could someone kindly point to me some reference links for understanding
igen based simulators? Especially the syntax used in igen?

  I would like to know how to add new instructions and remove some
instructions that are not supported in our new architecture?

Thanks

--Xinan






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

* "igen vs. cgen?"
  2004-07-21 19:15             ` "igen based simulators doc.?" Xinan Tang
@ 2004-07-21 20:24               ` Xinan Tang
  2004-07-22  9:35                 ` Monika Chaddha
  2004-07-23 19:03               ` "igen based simulators doc.?" Andrew Cagney
  1 sibling, 1 reply; 15+ messages in thread
From: Xinan Tang @ 2004-07-21 20:24 UTC (permalink / raw)
  To: gdb

Hi

  When I search the gdb mailing list for adding a new simulator, two
approaches were mentioned: igen vs. cgen.

  Now igen (psim) was included within gdb, is there any consensus which one
should be used within gdb for adding a new simulator?

Thanks

--Xinan

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

* RE: "igen vs. cgen?"
  2004-07-21 20:24               ` "igen vs. cgen?" Xinan Tang
@ 2004-07-22  9:35                 ` Monika Chaddha
  2004-07-22 19:12                   ` Xinan Tang
  0 siblings, 1 reply; 15+ messages in thread
From: Monika Chaddha @ 2004-07-22  9:35 UTC (permalink / raw)
  To: 'Xinan Tang'; +Cc: gdb

Hi Xinan

Igen would be used for adding new simulator input. There are many igen
files present in the source... Mips.igen, M16.igen etc...

The source for 'igen' (the simulator generator used) is present at
'src/sim/igen'. The 'igen' simulator generator takes input the mips.igen
file which includes other igen files and generates the simulator source.


The source for simulator will generate in build directory. The contents
of this source will depend on the input 'mips.igen' file. These files
are responsible for instruction implementation.

U need new model name also to add any new instruction.

Monika


>-----Original Message-----
>From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com] On
>Behalf Of Xinan Tang
>Sent: Thursday, July 22, 2004 12:46 AM
>To: gdb@sources.redhat.com
>Subject: "igen vs. cgen?"
>
>Hi
>
>  When I search the gdb mailing list for adding a new simulator, two
>approaches were mentioned: igen vs. cgen.
>
>  Now igen (psim) was included within gdb, is there any consensus which
one
>should be used within gdb for adding a new simulator?
>
>Thanks
>
>--Xinan


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

* RE: "igen vs. cgen?"
  2004-07-22  9:35                 ` Monika Chaddha
@ 2004-07-22 19:12                   ` Xinan Tang
  2004-07-23  8:11                     ` Monika Chaddha
  0 siblings, 1 reply; 15+ messages in thread
From: Xinan Tang @ 2004-07-22 19:12 UTC (permalink / raw)
  To: Monika Chaddha; +Cc: gdb

Hi Monika,

  Thanks for the reply.

  Is there doc. showing any examples on how to add a new instruction or
disable some existing ones based on existing *.igen files?

  I googled the web and only found a few pages from psim online manual.
However it does not provide enough details.

Thanks

--Xinan

-----Original Message-----
From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com]On Behalf Of Monika Chaddha
Sent: Wednesday, July 21, 2004 11:12 PM
To: 'Xinan Tang'
Cc: gdb@sources.redhat.com
Subject: RE: "igen vs. cgen?"


Hi Xinan

Igen would be used for adding new simulator input. There are many igen
files present in the source... Mips.igen, M16.igen etc...

The source for 'igen' (the simulator generator used) is present at
'src/sim/igen'. The 'igen' simulator generator takes input the mips.igen
file which includes other igen files and generates the simulator source.


The source for simulator will generate in build directory. The contents
of this source will depend on the input 'mips.igen' file. These files
are responsible for instruction implementation.

U need new model name also to add any new instruction.

Monika


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

* RE: "igen vs. cgen?"
  2004-07-22 19:12                   ` Xinan Tang
@ 2004-07-23  8:11                     ` Monika Chaddha
  0 siblings, 0 replies; 15+ messages in thread
From: Monika Chaddha @ 2004-07-23  8:11 UTC (permalink / raw)
  To: 'Xinan Tang'; +Cc: gdb

Yes.... you will not find any specific document.

I can provide u some idea ... if it helps u
I'll take one example and try to explain u.

000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD
"add r<RD>, r<RS>, r<RT>"
*mipsI:
*mipsII:
*mipsIII:
*mipsIV:
*mipsV:
*mips32:
*mips64:
*vr4100:
*vr5000:
*r3900:
{
------
------
}
The above is existing code for add instruction in mips.igen. You want
that this instruction should be supported by your architecture.

Firstly you need to change configuration files. Firstly add your
architecture based information in configure files in main directory and
sim directory

Example: /src/sim/mips/configure

For mipsisa32 the configuration information is as follows

mipsisa32*-*-*)	sim_gen=IGEN
			sim_igen_machine="-M mips32"
			sim_igen_filter="32,f"
			sim_mach_default="mipsisa32"
			;;

Here sim_gen is simulator generator
Sim_igen_machine will work as a model name ie for mipisa32 the model
name is mips32.
sim_igen_filter is size of instructions
sim_mach_defult is for bfd.

You also define ur architecture. Put yours entry wherever needed in the
configuration files.

Suppose u have defined as followes for architecture xyz

xyz*-*-*)		sim_gen=IGEN
			sim_igen_machine="-M xyz"
			sim_igen_filter="32,f"
			sim_mach_default="mipsisa32"
			;;

Also add this target name in the configuration files in the main
directory
If you want add instruction to be support by ur architecture "xyz"
Than put ur architecture name in the model list as follows

000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD
"add r<RD>, r<RS>, r<RT>"
*mipsI:
*mipsII:
*mipsIII:
*mipsIV:
*mipsV:
*mips32:
*mips64:
*vr4100:
*vr5000:
*r3900:
*xyz: (new architecture)
{
------
------
}

Now if u build gdb for "xyz", this "ADD" instruction will be
supported.If u don't want to support this instruction ... remove ur
model name from here.


Regards
Monika
>-----Original Message-----
>From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com] On
>Behalf Of Xinan Tang
>Sent: Friday, July 23, 2004 12:23 AM
>To: Monika Chaddha
>Cc: gdb@sources.redhat.com
>Subject: RE: "igen vs. cgen?"
>
>Hi Monika,
>
>  Thanks for the reply.
>
>  Is there doc. showing any examples on how to add a new instruction or
>disable some existing ones based on existing *.igen files?
>
>  I googled the web and only found a few pages from psim online manual.
>However it does not provide enough details.
>
>Thanks
>
>--Xinan
>
>-----Original Message-----
>From: gdb-owner@sources.redhat.com
>[mailto:gdb-owner@sources.redhat.com]On Behalf Of Monika Chaddha
>Sent: Wednesday, July 21, 2004 11:12 PM
>To: 'Xinan Tang'
>Cc: gdb@sources.redhat.com
>Subject: RE: "igen vs. cgen?"
>
>
>Hi Xinan
>
>Igen would be used for adding new simulator input. There are many igen
>files present in the source... Mips.igen, M16.igen etc...
>
>The source for 'igen' (the simulator generator used) is present at
>'src/sim/igen'. The 'igen' simulator generator takes input the
mips.igen
>file which includes other igen files and generates the simulator
source.
>
>
>The source for simulator will generate in build directory. The contents
>of this source will depend on the input 'mips.igen' file. These files
>are responsible for instruction implementation.
>
>U need new model name also to add any new instruction.
>
>Monika
>


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

* Re: "igen based simulators doc.?"
  2004-07-21 19:15             ` "igen based simulators doc.?" Xinan Tang
  2004-07-21 20:24               ` "igen vs. cgen?" Xinan Tang
@ 2004-07-23 19:03               ` Andrew Cagney
  1 sibling, 0 replies; 15+ messages in thread
From: Andrew Cagney @ 2004-07-23 19:03 UTC (permalink / raw)
  To: Xinan Tang; +Cc: gdb

The igen/ header files describe the syntax.  As for details, as Monika 
Chaddha as suggested, the best source of info is various examples.

Andrew

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

* RE: "igen vs. cgen?"
@ 2004-07-23 19:04 xinan tang
  0 siblings, 0 replies; 15+ messages in thread
From: xinan tang @ 2004-07-23 19:04 UTC (permalink / raw)
  To: Monika Chaddha; +Cc: gdb

Hi Monika,

  Thanks a lot and I now understood the way how to add a new model
(architecture) into GDB simulator.

  One question about the syntax used in specifying each instruction. Is
it specific for MIPS or applicable to any other ISA?

  For example,

  000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD

  In MIPS ISA encoding, it represents:

  opcode   = 000000
  sa       =  00000
  function = 100000  (ADD)

  and there are three general registers rs, rt, and rd, each takes
5bits.

  What does the "empty" field between '32::ADD' mean? Can we use this
scheme to describe any other architecture?

Thanks

--Xinan 
 

-----Original Message-----
From: gdb-owner@sources.redhat.com [mailto:gdb-owner@sources.redhat.com]
On Behalf Of Monika Chaddha
Sent: Thursday, July 22, 2004 9:42 PM
To: xinan tang
Cc: gdb@sources.redhat.com
Subject: RE: "igen vs. cgen?"

Yes.... you will not find any specific document.

I can provide u some idea ... if it helps u
I'll take one example and try to explain u.

000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD
"add r<RD>, r<RS>, r<RT>"
*mipsI:
*mipsII:
*mipsIII:
*mipsIV:
*mipsV:
*mips32:
*mips64:
*vr4100:
*vr5000:
*r3900:
{
------
------
}
The above is existing code for add instruction in mips.igen. You want
that this instruction should be supported by your architecture.

Firstly you need to change configuration files. Firstly add your
architecture based information in configure files in main directory and
sim directory

Example: /src/sim/mips/configure

For mipsisa32 the configuration information is as follows

mipsisa32*-*-*)	sim_gen=IGEN
			sim_igen_machine="-M mips32"
			sim_igen_filter="32,f"
			sim_mach_default="mipsisa32"
			;;

Here sim_gen is simulator generator
Sim_igen_machine will work as a model name ie for mipisa32 the model
name is mips32.
sim_igen_filter is size of instructions
sim_mach_defult is for bfd.

You also define ur architecture. Put yours entry wherever needed in the
configuration files.

Suppose u have defined as followes for architecture xyz

xyz*-*-*)		sim_gen=IGEN
			sim_igen_machine="-M xyz"
			sim_igen_filter="32,f"
			sim_mach_default="mipsisa32"
			;;

Also add this target name in the configuration files in the main
directory
If you want add instruction to be support by ur architecture "xyz"
Than put ur architecture name in the model list as follows

000000,5.RS,5.RT,5.RD,00000,100000:SPECIAL:32::ADD
"add r<RD>, r<RS>, r<RT>"
*mipsI:
*mipsII:
*mipsIII:
*mipsIV:
*mipsV:
*mips32:
*mips64:
*vr4100:
*vr5000:
*r3900:
*xyz: (new architecture)
{
------
------
}

Now if u build gdb for "xyz", this "ADD" instruction will be
supported.If u don't want to support this instruction ... remove ur
model name from here.


Regards
Monika
>-----Original Message-----
>From: gdb-owner@sources.redhat.com
[mailto:gdb-owner@sources.redhat.com] On
>Behalf Of Xinan Tang
>Sent: Friday, July 23, 2004 12:23 AM
>To: Monika Chaddha
>Cc: gdb@sources.redhat.com
>Subject: RE: "igen vs. cgen?"
>
>Hi Monika,
>
>  Thanks for the reply.
>
>  Is there doc. showing any examples on how to add a new instruction or
>disable some existing ones based on existing *.igen files?
>
>  I googled the web and only found a few pages from psim online manual.
>However it does not provide enough details.
>
>Thanks
>
>--Xinan
>
>-----Original Message-----
>From: gdb-owner@sources.redhat.com
>[mailto:gdb-owner@sources.redhat.com]On Behalf Of Monika Chaddha
>Sent: Wednesday, July 21, 2004 11:12 PM
>To: 'Xinan Tang'
>Cc: gdb@sources.redhat.com
>Subject: RE: "igen vs. cgen?"
>
>
>Hi Xinan
>
>Igen would be used for adding new simulator input. There are many igen
>files present in the source... Mips.igen, M16.igen etc...
>
>The source for 'igen' (the simulator generator used) is present at
>'src/sim/igen'. The 'igen' simulator generator takes input the
mips.igen
>file which includes other igen files and generates the simulator
source.
>
>
>The source for simulator will generate in build directory. The contents
>of this source will depend on the input 'mips.igen' file. These files
>are responsible for instruction implementation.
>
>U need new model name also to add any new instruction.
>
>Monika
>



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

end of thread, other threads:[~2004-07-23 19:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <KAEHILJLFHMPJPLKAFBHAEDFCBAA.xinan@tidalnetworks.net>
2004-06-16  1:53 ` "Info reg doesn't work" Jim Blandy
2004-07-16 21:46   ` "which function is called when updating a register?" Xinan Tang
2004-07-18 20:38     ` Andrew Cagney
2004-07-19 18:50       ` Xinan Tang
2004-07-19 18:59         ` Andrew Cagney
2004-07-21  5:24           ` "Add sim memory region by default" Xinan Tang
2004-07-21 15:48             ` Dave Korn
2004-07-21 17:53               ` Xinan Tang
2004-07-21 19:15             ` "igen based simulators doc.?" Xinan Tang
2004-07-21 20:24               ` "igen vs. cgen?" Xinan Tang
2004-07-22  9:35                 ` Monika Chaddha
2004-07-22 19:12                   ` Xinan Tang
2004-07-23  8:11                     ` Monika Chaddha
2004-07-23 19:03               ` "igen based simulators doc.?" Andrew Cagney
2004-07-23 19:04 "igen vs. cgen?" xinan tang

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