Re: GDB 8.0 release/branching 2017-03-20 update

Yao Qi
2017-03-21T13:07:56Z

Yao Qi <qiyaoltc@gmail.com> writes:

[cc Doug who reviewed the patches v6]

> I'll post my design draft tomorrow, then people can compare
> the current design to mine. If we think we need to improve the
> current design, it is unlikely to get it done by 8.0.

Python APIs of record and btrace

This summarizes the new added record and btrace Python APIs, in order
to facilitate the discussion that whether we need to release them in
8.0.

* Current status and design

These new python APIs and classes are added to master already.

BtraceInstruction
{
int number;
int error;
gdb.Symtab_and_line sal;
pc, data, decoded, size;
is_speculative;
};

BtraceFunctionCall
{
int number;
gdb.Symbol symbol;
int level;
BtraceInstruction instructions;
BtraceFunctionCall up, prev_sibling, next_sibling;
};

gdb.current_recording (), gdb.start_recording and
gdb.stop_recording (),

Record
{
ptid;
format;
begin, end;
replay_position;
instruction_history, function_call_history;
};

* Issues in the APIs and suggestions

1. BtraceInstruction.sal is not necessary. It can be got via
gdb.find_pc_line(BtraceInstruction.pc).

2. BtraceInstruction has some attributes (pc, data, decoded, and size,)
which are not btrace related.
They should be moved to a new class gdb.Instruction and BtraceInstruction
extends it.

Instruction
{
pc, data, decode, size;
};

BtraceInstruction : Instruction
{
int number;
int error;
is_speculative;
};

gdb.Instruction can be used in somewhere else, for example, we can add
a function Inferior.read_code (address), which returns gdb.Instruction.
The record of other methods, like "full", can get its own instructions,
but they have to be extended from gdb.Instruction. Just like
gdb.FinishBreakpoint extends gdb.Breakpoint.

3. Why does Record have an attribute ptid?
Other record method may have process-wide record/trace. I'd like to put
common attributes in Record, and extend Record for each specific record
method.

Record
{
method, format;
instruction_history;
};

BtraceRecord : Record
{
ptid;
...
};

FullRecord : Record
{
};

gdb.current_recording () can be a factory returning the right Record
object according to target_record_method (inferior_ptid).

* Actions

According to my analysis above, these APIs still need some adjustments
and re-designs, so I request to revert these commits below,

cee59b3 Fix break on Python 2
0a0faf9 Add documentation for new record Python bindings.
714aa61 python: Add tests for record Python bindings
75c0bdf python: Implement btrace Python bindings for record history.
4726b2d python: Create Python bindings for record history.

and add them back gradually after 8.0 release. To be clear, I can offer
some times review the new design and patches later, but I don't take
over this project, Tim is still the owner.

--
Yao (齐尧)