Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] reserve proposed new bytecodes
@ 2014-08-26 21:54 David Taylor
  2014-08-27  2:46 ` Eli Zaretskii
  2014-08-28 13:09 ` Yao Qi
  0 siblings, 2 replies; 5+ messages in thread
From: David Taylor @ 2014-08-26 21:54 UTC (permalink / raw)
  To: gdb-patches

I proposed on the gdb list some new bytecodes -- setmem8, setmem16,
setmem32, setmem64, and setreg -- for the GDB agent expression
mechanism.  I posted a message on July 28th and then a more detailed
version on August 22nd.

So far only Eli Zaretskii has replied.  I take that to mean that no one
has strong feelings yea or nay about it or possibly no one other than
Eli has bothered to read it.  Hopefully the former.

We (EMC) plan to implment some variant of this and I'd like it to be
done in such a manner as to be acceptable for inclusion into GDB.

While I am hoping that we (EMC) implement this before the end of the
year, I realize that I don't control the which task has the highest
priority.  So...

I'd like to informally reserve the opcodes and define their syntax and
semantics.  Anyone looking to add a new opcode will look at either
gdb/doc/agentexpr.texi and/or gdb/common/ax.def.

To that end, here's a patch that edits both files and includes ChangeLog
entries.  With this change gdb still builds as do the pdf, html, and
info targets.

Entry for gdb/ChangeLog:

2014-08-26  David Taylor  <dtaylor@emc.com>

	* common/ax.def: Add DEFOP entries for proposed bytecodes setmem8,
	setmem16, setmem32, setmem64, and setreg.

Entry for gdb/doc/ChangeLog:

2014-08-26  David Taylor  <dtaylor@emc.com>

	* agentexpr.texi (Bytecode Descriptions): Add decsriptions of
	propmosed bytecodes setmem8, setmem16, setmem32, setmem64, and
	setreg.

The actual diff (against GDB 7.8, but these two files don't change very
often):

Index: gdb/common/ax.def
===================================================================
RCS file: /home/cvsroot/GDB/gdb/common/ax.def,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 ax.def
--- gdb/common/ax.def	18 Feb 2014 15:36:03 -0000	1.1.1.2
+++ gdb/common/ax.def	26 Aug 2014 19:22:12 -0000
@@ -95,3 +95,9 @@
 DEFOP (rot, 0, 0, 3, 3, 0x33)
 /* Both the argument and consumed numbers are dynamic for this one.  */
 DEFOP (printf, 0, 0, 0, 0, 0x34)
+/* The following five operands are not yet implemented.  */
+DEFOP (setmem8, 0, 8, 2, 0, 0x35)
+DEFOP (setmem16, 0, 16, 2, 0, 0x36)
+DEFOP (setmem32, 0, 32, 2, 0, 0x37)
+DEFOP (setmem64, 0, 64, 2, 0, 0x38)
+DEFOP (setreg, 2, 0, 1, 0, 0x39)
Index: gdb/doc/agentexpr.texi
===================================================================
RCS file: /home/cvsroot/GDB/gdb/doc/agentexpr.texi,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 agentexpr.texi
--- gdb/doc/agentexpr.texi	18 Feb 2014 15:36:03 -0000	1.1.1.2
+++ gdb/doc/agentexpr.texi	26 Aug 2014 19:22:12 -0000
@@ -516,6 +516,28 @@
 range of memory, then the next-to-top of the stack is the lvalue's
 address, and the top of the stack is the lvalue's size, in bytes.
 
+@item @code{setmem8} (0x35): @var{addr} @var{value} @result{}
+@itemx @code{setmem16} (0x36): @var{addr} @var{value} @result{}
+@itemx @code{setmem32} (0x37): @var{addr} @var{value} @result{}
+@itemx @code{setmem64} (0x38): @var{addr} @var{value} @result{}
+Pop an address @var{addr} and value @var{value} from the stack.  For
+bytecode @code{setmem}@var{n}, set an @var{n}-bit value at @var{addr},
+using the @var{n}-bit least significant bits of @var{value} and natural
+target endianness.
+
+If attempting to write memory at @var{addr} would cause a processor
+exception of some sort, terminate with an error.
+
+Not implemented yet.
+
+@item @code{setreg} (0x39) @var{regnum}: @var{value} @result{}
+Pop @var{value} from the stack.  Set register @var{regnum} to @var{value}.
+
+If the register is read-only or if attempting to write @var{value} to it
+would cause a processor exception of some sort, terminate with an error.
+
+Not implemented yet.
+
 @end table
 
 
EMC has a copyright assignment on file.  I do not have commit privileges.


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

* Re: [PATCH] reserve proposed new bytecodes
  2014-08-26 21:54 [PATCH] reserve proposed new bytecodes David Taylor
@ 2014-08-27  2:46 ` Eli Zaretskii
  2014-08-27 13:50   ` David Taylor
  2014-08-28 13:09 ` Yao Qi
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2014-08-27  2:46 UTC (permalink / raw)
  To: David Taylor; +Cc: gdb-patches

> From: David Taylor <dtaylor@emc.com>
> Date: Tue, 26 Aug 2014 17:54:20 -0400
> 
> +@item @code{setmem8} (0x35): @var{addr} @var{value} @result{}
> +@itemx @code{setmem16} (0x36): @var{addr} @var{value} @result{}
> +@itemx @code{setmem32} (0x37): @var{addr} @var{value} @result{}
> +@itemx @code{setmem64} (0x38): @var{addr} @var{value} @result{}

I asked you to put "(nothing)" after @result{}.

> +@item @code{setreg} (0x39) @var{regnum}: @var{value} @result{}

Likewise here.


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

* Re: [PATCH] reserve proposed new bytecodes
  2014-08-27  2:46 ` Eli Zaretskii
@ 2014-08-27 13:50   ` David Taylor
  2014-08-27 14:55     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: David Taylor @ 2014-08-27 13:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

Eli Zaretskii <eliz@gnu.org> wrote:

> > From: David Taylor <dtaylor@emc.com>
> > Date: Tue, 26 Aug 2014 17:54:20 -0400
> > 
> > +@item @code{setmem8} (0x35): @var{addr} @var{value} @result{}
> > +@itemx @code{setmem16} (0x36): @var{addr} @var{value} @result{}
> > +@itemx @code{setmem32} (0x37): @var{addr} @var{value} @result{}
> > +@itemx @code{setmem64} (0x38): @var{addr} @var{value} @result{}
> 
> I asked you to put "(nothing)" after @result{}.
> 
> > +@item @code{setreg} (0x39) @var{regnum}: @var{value} @result{}
> 
> Likewise here.

You're right.  Sorry.  Here's a revised version with the 5 requested
insertions of (nothing) in agentexpr.texi.  The pdf, info, and html
targets all succeeded; visually the modified parts of gdb.pdf looked
correct.


Entry for gdb/ChangeLog:

2014-08-26  David Taylor  <dtaylor@emc.com>

	* common/ax.def: Add DEFOP entries for proposed bytecodes setmem8,
	setmem16, setmem32, setmem64, and setreg.

Entry for gdb/doc/ChangeLog:

2014-08-26  David Taylor  <dtaylor@emc.com>

	* agentexpr.texi (Bytecode Descriptions): Add decsriptions of
	propmosed bytecodes setmem8, setmem16, setmem32, setmem64, and
	setreg.

The actual diff (against GDB 7.8, but these two files don't change very
often):

Index: gdb/common/ax.def
===================================================================
RCS file: /home/cvsroot/GDB/gdb/common/ax.def,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 ax.def
--- gdb/common/ax.def	18 Feb 2014 15:36:03 -0000	1.1.1.2
+++ gdb/common/ax.def	26 Aug 2014 19:22:12 -0000
@@ -95,3 +95,9 @@
 DEFOP (rot, 0, 0, 3, 3, 0x33)
 /* Both the argument and consumed numbers are dynamic for this one.  */
 DEFOP (printf, 0, 0, 0, 0, 0x34)
+/* The following five operands are not yet implemented.  */
+DEFOP (setmem8, 0, 8, 2, 0, 0x35)
+DEFOP (setmem16, 0, 16, 2, 0, 0x36)
+DEFOP (setmem32, 0, 32, 2, 0, 0x37)
+DEFOP (setmem64, 0, 64, 2, 0, 0x38)
+DEFOP (setreg, 2, 0, 1, 0, 0x39)
Index: gdb/doc/agentexpr.texi
===================================================================
RCS file: /home/cvsroot/GDB/gdb/doc/agentexpr.texi,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 agentexpr.texi
--- gdb/doc/agentexpr.texi	18 Feb 2014 15:36:03 -0000	1.1.1.2
+++ gdb/doc/agentexpr.texi	27 Aug 2014 13:45:00 -0000
@@ -516,6 +516,28 @@
 range of memory, then the next-to-top of the stack is the lvalue's
 address, and the top of the stack is the lvalue's size, in bytes.
 
+@item @code{setmem8} (0x35): @var{addr} @var{value} @result{} (nothing)
+@itemx @code{setmem16} (0x36): @var{addr} @var{value} @result{} (nothing)
+@itemx @code{setmem32} (0x37): @var{addr} @var{value} @result{} (nothing)
+@itemx @code{setmem64} (0x38): @var{addr} @var{value} @result{} (nothing)
+Pop an address @var{addr} and value @var{value} from the stack.  For
+bytecode @code{setmem}@var{n}, set an @var{n}-bit value at @var{addr},
+using the @var{n}-bit least significant bits of @var{value} and natural
+target endianness.
+
+If attempting to write memory at @var{addr} would cause a processor
+exception of some sort, terminate with an error.
+
+Not implemented yet.
+
+@item @code{setreg} (0x39) @var{regnum}: @var{value} @result{} (nothing)
+Pop @var{value} from the stack.  Set register @var{regnum} to @var{value}.
+
+If the register is read-only or if attempting to write @var{value} to it
+would cause a processor exception of some sort, terminate with an error.
+
+Not implemented yet.
+
 @end table
 
 


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

* Re: [PATCH] reserve proposed new bytecodes
  2014-08-27 13:50   ` David Taylor
@ 2014-08-27 14:55     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2014-08-27 14:55 UTC (permalink / raw)
  To: David Taylor; +Cc: gdb-patches

> cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
> Date: Wed, 27 Aug 2014 09:49:59 -0400
> From: David Taylor <dtaylor@emc.com>
> 
> Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > > From: David Taylor <dtaylor@emc.com>
> > > Date: Tue, 26 Aug 2014 17:54:20 -0400
> > > 
> > > +@item @code{setmem8} (0x35): @var{addr} @var{value} @result{}
> > > +@itemx @code{setmem16} (0x36): @var{addr} @var{value} @result{}
> > > +@itemx @code{setmem32} (0x37): @var{addr} @var{value} @result{}
> > > +@itemx @code{setmem64} (0x38): @var{addr} @var{value} @result{}
> > 
> > I asked you to put "(nothing)" after @result{}.
> > 
> > > +@item @code{setreg} (0x39) @var{regnum}: @var{value} @result{}
> > 
> > Likewise here.
> 
> You're right.  Sorry.  Here's a revised version with the 5 requested
> insertions of (nothing) in agentexpr.texi.  The pdf, info, and html
> targets all succeeded; visually the modified parts of gdb.pdf looked
> correct.

This version is fine with me.  Thanks.

> Entry for gdb/doc/ChangeLog:
> 
> 2014-08-26  David Taylor  <dtaylor@emc.com>
> 
> 	* agentexpr.texi (Bytecode Descriptions): Add decsriptions of
                                                      ^^^^^^^^^^^^
A typo.

> 	propmosed bytecodes setmem8, setmem16, setmem32, setmem64, and
        ^^^^^^^^^
Another one.


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

* Re: [PATCH] reserve proposed new bytecodes
  2014-08-26 21:54 [PATCH] reserve proposed new bytecodes David Taylor
  2014-08-27  2:46 ` Eli Zaretskii
@ 2014-08-28 13:09 ` Yao Qi
  1 sibling, 0 replies; 5+ messages in thread
From: Yao Qi @ 2014-08-28 13:09 UTC (permalink / raw)
  To: David Taylor; +Cc: gdb-patches

David Taylor <dtaylor@emc.com> writes:

> I'd like to informally reserve the opcodes and define their syntax and
> semantics.  Anyone looking to add a new opcode will look at either
> gdb/doc/agentexpr.texi and/or gdb/common/ax.def.

I don't understand why do you have to reserve these opcodes?  IMO, these
opcodes should be added when you contribute your work, together with the
implementations.  Although it may be possible that some one adds a new
opcode during your development, you still can simply 'rebase' your
opcodes on top of the trunk.

-- 
Yao (齐尧)


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

end of thread, other threads:[~2014-08-28 13:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-26 21:54 [PATCH] reserve proposed new bytecodes David Taylor
2014-08-27  2:46 ` Eli Zaretskii
2014-08-27 13:50   ` David Taylor
2014-08-27 14:55     ` Eli Zaretskii
2014-08-28 13:09 ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox