Discussion:
possible gdb agent expression extension
(too old to reply)
David Taylor
2014-07-28 14:39:01 UTC
Permalink
We're thinking of extending gdb agent expreswions by adding additional
bytecodes. Before doing this I'd like to determine whether the idea of
doing this would be looked upon favorably and what form it should take.

[One of our current goals with regard to GDB is to use stock GDB sources
as much as possible and to only make changes that are either bug fixes
or extensions that when contributed back are likely to be looked upon
favorably in concept and hopefully in implementation.]

We would like to be able to set variables using byte code expressions.
In practice this means being able to set memory and being able to set
registers. There are no byte code for either of these.

For setting registers, a new opcode 'setreg'. Like 'reg' the next two
bytes of the bytecode stream are the register number. Top of expression
stack is the value to set it to. And the top of the expression stack is
popped.

For setting memory, two possibilities come to mind:

. either, one opcode 'set' or 'setmem' with next byte in byte code
stream saying how big a chunk of memory to set, with top two values on
expression stack being the address to set and the value to set it to.

. or, four new opcodes (similar to 'ref' and 'const') -- set8, set16,
set32, and set64 with, again, top two values on expression stack being
the address to set and the value to set it to.

Is this something people would like to see added?

Which approach do people feel is better? Which should be top of stack?
Address? Or value? And should they be popped?

As I have other, higher priority, items to work on, it will likely be
awhile before I start on this.

Loading...