public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* cgen-cpu/tracedis.c patch
@ 2002-01-22 15:37 Ben Elliston
  2002-01-22 18:03 ` matthew green
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Elliston @ 2002-01-22 15:37 UTC (permalink / raw)
  To: sid

The following patch adds a few more BFD functions to tracedis.c.  They
are needed because a simulator I am targetting already has a
hand-written disassembler which uses these BFD functions.  Okay to
commit?

At what point will be abandon this approach and make SID dependent on
libbfd?

Ben


2002-01-23  Ben Elliston  <bje@redhat.com>

	* tracedis.c (bfd_getb16): New function.
	(bfd_getl16): Likewise.
	(bfd_getb32): Likewise.
	(bfd_getl32): Likewise.

Index: tracedis.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/cgen-cpu/tracedis.c,v
retrieving revision 1.2
diff -u -c -r1.2 tracedis.c
*** tracedis.c	2001/06/08 07:18:50	1.2
--- tracedis.c	2002/01/22 23:35:06
***************
*** 60,65 ****
--- 60,106 ----
  }
  
  /* Stolen from libbfd.  */
+ 
+ bfd_vma
+ bfd_getb16 (addr)
+      register const bfd_byte *addr;
+ {
+   return (addr[0] << 8) | addr[1];
+ }
+ 
+ bfd_vma
+ bfd_getl16 (addr)
+      register const bfd_byte *addr;
+ {
+   return (addr[1] << 8) | addr[0];
+ }
+ 
+ bfd_vma
+ bfd_getb32 (addr)
+      register const bfd_byte *addr;
+ {
+   unsigned long v;
+ 
+   v = (unsigned long) addr[0] << 24;
+   v |= (unsigned long) addr[1] << 16;
+   v |= (unsigned long) addr[2] << 8;
+   v |= (unsigned long) addr[3];
+   return (bfd_vma) v;
+ }
+ 
+ bfd_vma
+ bfd_getl32 (addr)
+      register const bfd_byte *addr;
+ {
+   unsigned long v;
+ 
+   v = (unsigned long) addr[0];
+   v |= (unsigned long) addr[1] << 8;
+   v |= (unsigned long) addr[2] << 16;
+   v |= (unsigned long) addr[3] << 24;
+   return (bfd_vma) v;
+ }
+ 
  void
  bfd_put_bits (data, addr, bits, big_p)
       bfd_vma data;

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

* re: cgen-cpu/tracedis.c patch
  2002-01-22 15:37 cgen-cpu/tracedis.c patch Ben Elliston
@ 2002-01-22 18:03 ` matthew green
  2002-01-22 18:48   ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: matthew green @ 2002-01-22 18:03 UTC (permalink / raw)
  To: Ben Elliston; +Cc: sid


   The following patch adds a few more BFD functions to tracedis.c.  They
   are needed because a simulator I am targetting already has a
   hand-written disassembler which uses these BFD functions.  Okay to
   commit?

looks fine.
   
   At what point will be abandon this approach and make SID dependent on
   libbfd?


i'd like to.  it would allow --trace-disasm to get at symbols..


.mrg.

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

* Re: cgen-cpu/tracedis.c patch
  2002-01-22 18:03 ` matthew green
@ 2002-01-22 18:48   ` Frank Ch. Eigler
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Ch. Eigler @ 2002-01-22 18:48 UTC (permalink / raw)
  To: matthew green; +Cc: sid

Hi -

On Wed, Jan 23, 2002 at 01:02:41PM +1100, matthew green wrote:
> [...]
>    At what point will be abandon this approach and make SID dependent on
>    libbfd?
> 
> i'd like to.  it would allow --trace-disasm to get at symbols..

Linking with bfd opens up more cans of worms, some of which we have
discovered in earlier experiments.  Besides, there are other ways
to let trace-disasm see symbols: see for example how addr2line is
used by the (currently defunct) visual memory tracer thingie.


- FChE

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

end of thread, other threads:[~2002-01-23  2:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-22 15:37 cgen-cpu/tracedis.c patch Ben Elliston
2002-01-22 18:03 ` matthew green
2002-01-22 18:48   ` Frank Ch. Eigler

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