Re: [RFA/RFC Prec] Add process record skip 6/6 (doc)

Hui Zhu
2009-09-01T08:57:13Z

[-- Attachment #1: Type: text/plain, Size: 5766 bytes --]

On Tue, Sep 1, 2009 at 00:44, Eli Zaretskii<eliz@gnu.org> wrote:
>> From: Hui Zhu <teawater@gmail.com>
>> Date: Mon, 31 Aug 2009 21:26:04 +0800
>> Cc: gdb-patches@sourceware.org, msnyder@vmware.com, green@moxielogic.com
>>
>> --000e0cd72d34f48d8004726ffae8
>> Content-Type: text/plain; charset=ISO-8859-1
>> Content-Transfer-Encoding: quoted-printable
>>
>> On Thu, Aug 27, 2009 at 01:50, Eli Zaretskii<eliz@gnu.org> wrote:
>> >> From: Hui Zhu <teawater@gmail.com>
>> >> Date: Tue, 25 Aug 2009 11:47:09 +0800
>> >> Cc: gdb-patches@sourceware.org, msnyder@vmware.com, green@moxielogic.com
>> >>
>> >> >> i386_linux_process_record_simple_function is for printf.
>> >> >> i386_linux_process_record_memset is for memset and memcpy.
>> >> >
>> >> > So we currently support record skip of only 3 functions, the ones
>> >> > mentioned above, is that right? =A0In that case, we should document
>> >> > those functions in the manual, I think.
>> >>
>> >> Yes, I think after this feature in, we can add more and more functions
>> >> to support skip.
>> >
>> > But then the proposed code is IMHO awfully limited, isn't it?  Why
>> > not add some more general mechanism, for several broad classes of
>> > functions (like the `simple_function' class you used for `printf'),
>> > and let the user specify which functions she wants to skip, instead of
>> > hard-coding the functions in GDB?
>> >
>> > By contrast, the suggested code will cause us to have gobs of library
>> > functions intimately known to GDB, and will bloat the executable, for
>> > starters.
>
> You didn't answer these concerns.  Nor did anyone else; am I the only
> one who is bothered by the ad-hoc nature of such design?
>

Sorry I forgot it.
I think this idea is not bad. But when user set a simple_function to
GDB, check if this function is really a simple function or not is not
easy. What about keep this idea and add special patch for it when gdb
support record skip?

>> > Also, why is this code being make Linux-specific? =A0Surely, most, if
>> > not all, other implementations of `printf', `memset' and `memcpy' have
>> > the exact same API and the same external effects as those you have in
>> > glibc, no?
>>
>> The api is same, but the ABI for each arch and os is not same, each
>> printf, memset or memcpy of each arch-os will get the argument from
>> different memory and different register.  And they will change
>> different memory and reg.
>
> Are you talking in general, or are you talking about the x86
> architecture?  I think all x86 implementations of `printf' and
> `memset' will use the same ABI, certainly those that use GCC as the
> native compiler.

Yes, I think they are same in 32 bits. But x86 is special, it need
support amd64 too. It's 64 bits and have another different registers.
So..
I think the arch developer can call "record_skip_entry_create" in the
place that he like.

>
>> +The record skip entry is a special breakpoint.  When the process
>> +record and replay target start, it will be inserted to the
>> +begin of a function.  When this breakpoint break the inferior and
>   ^^^^^                                      ^^^^^             ^^^^
>   "beginning"                                "breaks"          ", if"
>
>> +@value{GDBN} is in record mode, @value{GDBN} will skip record all
>                                                     ^^^^^^^^^^^^^^^
>                                                     "refrain from recording"
>
>> +the execution log of this function's instructions and record the
>                                                     ^^^^^^^^^^
>                                                     "and only record"
>
>> +change of memory and registers of this function as one instruction.
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   "modifications of memory and registers by this function"
>
>> +Show the status of record skip.
>
>   "This command shows the status of record skipping."
>
>> +@item record skip disable @r{[}id@r{]}
>                                  ^^
>                                 "@var{id}"
>
>> +@item record skip enable @r{[}id@r{]}
>
> Likewise.
>
> OK with these changes.
>
> Thanks.
>

I make a new patch according to your comments.
Please help me review it.

Thanks,
Hui

---
doc/gdb.texinfo | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -5214,6 +5214,31 @@ When record target runs in replay mode (
subsequent execution log and begin to record a new execution log starting
from the current address. This means you will abandon the previously
recorded ``future'' and begin recording a new ``future''.
+
+@kindex record skip
+@kindex rec skip
+@item record skip
+The record skip entry is a special breakpoint. When the process
+record and replay target start, it will be inserted to the
+beginning of a function. When this breaks break, if
+@value{GDBN} is in record mode, refrain from recording skip record all
+the execution log of this function's instructions and only record the
+modifications of memory and registers by this function.
+This command shows the status of record skipping.
+
+Only some standard functions are currently supported by the
+@code{record skip} command; type the command without arguments to
+see the full list.
+
+@kindex record skip disable
+@kindex rec skip disable
+@item record skip disable @var{id}
+Disable the specified record skip entry (or all record skip entries).
+
+@kindex record skip enable
+@kindex rec skip enable
+@item record skip enable @var{id}
+Enable the specified record skip entry (or all record skip entries).
@end table

[-- Attachment #2: 6-skip-record-doc.txt --]
[-- Type: text/plain, Size: 1383 bytes --]

---
doc/gdb.texinfo | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

--- a/doc/gdb.texinfo
+++ b/doc/gdb.texinfo
@@ -5214,6 +5214,31 @@ When record target runs in replay mode (
subsequent execution log and begin to record a new execution log starting
from the current address. This means you will abandon the previously
recorded ``future'' and begin recording a new ``future''.
+
+@kindex record skip
+@kindex rec skip
+@item record skip
+The record skip entry is a special breakpoint. When the process
+record and replay target start, it will be inserted to the
+beginning of a function. When this breaks break, if
+@value{GDBN} is in record mode, refrain from recording skip record all
+the execution log of this function's instructions and only record the
+modifications of memory and registers by this function.
+This command shows the status of record skipping.
+
+Only some standard functions are currently supported by the
+@code{record skip} command; type the command without arguments to
+see the full list.
+
+@kindex record skip disable
+@kindex rec skip disable
+@item record skip disable @var{id}
+Disable the specified record skip entry (or all record skip entries).
+
+@kindex record skip enable
+@kindex rec skip enable
+@item record skip enable @var{id}
+Enable the specified record skip entry (or all record skip entries).
@end table