From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [1/2] Inspect extra signal information
Date: Thu, 05 Feb 2009 01:14:00 -0000 [thread overview]
Message-ID: <200902050114.05103.pedro@codesourcery.com> (raw)
In-Reply-To: <uocxkv9ct.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2002 bytes --]
On Monday 02 February 2009 21:04:34, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > I don't see struct value documented in
> > the internals manual though. What kind of detail do you require here?
>
> Exactly the kind you described.
Great.
> > I'm thinking of adding a "Values" section somewhere, don't know
> > where yet.
>
> The place doesn't matter much, since the internals manual is "work in
> progress", and looks more like a car crash than a concise document.
>
:-)
There doesn't seem there's a good way to place it, since values
are used for many things, so I made it a new chapter. I placed
it even before Stack Frames, because frame handling uses struct value.
> > @item @code{lval_computed}
> >
> > These are values with arbitrary functions to handle reads and writes,
>
> Please lose the empty line between the @item and its description.
>
Done.
> > and "copy operators" and "destructors". They allow creating
>
> Please use ``this kind of quoting'' in Texinfo, not "this kind".
>
Done. ( it shows I didn't write that in emacs :-) )
> > described by the @code{struct lval_funcs} struture declared in
> ^^^^^^^^
> A typo.
>
Fixed.
> > @file{value.h} to the @code{allocate_computed_value} function. An
>
> What does it mean "declared in value.h to the allocate_computed_value
> function"?
It means I wrote a too long sentence, and lost sense somewhere along the
way. :-)
"The creator of such a value specifies specialized read (...) callbacks (...)
to the @code{allocate_computed_value} function."
I've rewriten this. I think it's clearer now.
> Perhaps add a few words describing `struct lval_funcs', or maybe just
> showing a simple example would be enough.
I've added an example.
> A couple of index entries for this section will also help.
I've added them.
> Thanks again for working on this.
Thanks for the speedy review.
Here's a proper patch.
Does it look OK?
--
Pedro Alves
[-- Attachment #2: lval_computed_docs.diff --]
[-- Type: text/x-diff, Size: 3614 bytes --]
2009-02-04 Pedro Alves <pedro@codesourcery.com>
* gdbint.texinfo (Values): New chapter.
---
gdb/doc/gdbint.texinfo | 95 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
Index: src/gdb/doc/gdbint.texinfo
===================================================================
--- src.orig/gdb/doc/gdbint.texinfo 2009-02-03 19:20:40.000000000 +0000
+++ src/gdb/doc/gdbint.texinfo 2009-02-05 01:11:31.000000000 +0000
@@ -76,6 +76,7 @@ as the mechanisms that adapt @value{GDBN
* Algorithms::
* User Interface::
* libgdb::
+* Values::
* Stack Frames::
* Symbol Handling::
* Language Support::
@@ -1834,6 +1835,100 @@ the query interface. Each function is p
builder. The result of the query is constructed using that builder
before the query function returns.
+@node Values
+@chapter Values
+@section Values
+
+@cindex values
+@cindex @code{value} structure
+@value{GDBN} uses @code{struct value}, or @dfn{values}, as an internal
+abstraction for the representation of a variety of inferior objects
+and @value{GDBN} convenience objects.
+
+Values have an associated @code{struct type}, that describes a virtual
+view of the raw data or object stored in or accessed through the
+value.
+
+A value is in addition descriminated by its lvalue-ness, given its
+@code{enum lval_type} enumeration type:
+
+@cindex @code{lval_type} enumeration, for values.
+@table @code
+@item @code{not_lval}
+This value is not an lval. It can't be assigned to.
+
+@item @code{lval_memory}
+This value represents an object in memory.
+
+@item @code{lval_register}
+This value represents an object that lives in a register.
+
+@item @code{lval_internalvar}
+Represents the value of an internal variable.
+
+@item @code{lval_internalvar_component}
+Represents part of a gdb internal variable. E.g., a structure field.
+
+@cindex computed values
+@item @code{lval_computed}
+These are ``computed'' values. They allow creating specialized value
+objects for specific purposes, all abstracted way from the the core
+value support code. The creator of such a value writes specialized
+functions to handle the reading and writing to/from the value's
+backend data, and optionally, a ``copy operator'' and a
+``destructor''.
+
+Pointers to these functions are stored in a @code{struct lval_funcs}
+instance (declared in @file{value.h}), and passed to the
+@code{allocate_computed_value} function, as in the example below.
+
+@smallexample
+static void
+nil_value_read (struct value *v)
+@{
+ /* This callback reads data from some backend, and stores it in V.
+ In this case, we always read null data. You'll want to fill in
+ something more interesting. */
+
+ memset (value_contents_all_raw (v),
+ value_offset (v),
+ TYPE_LENGTH (value_type (v)));
+@}
+
+static void
+nil_value_write (struct value *v, struct value *fromval)
+@{
+ /* Takes the data from FROMVAL and stores it in the backend of V. */
+
+ to_oblivion (value_contents_all_raw (fromval),
+ value_offset (v),
+ TYPE_LENGTH (value_type (fromval)));
+@}
+
+static struct lval_funcs nil_value_funcs =
+ @{
+ nil_value_read,
+ nil_value_write
+ @};
+
+struct value *
+make_nil_value (void)
+@{
+ struct type *type;
+ struct value *v;
+
+ type = make_nils_type ();
+ v = allocate_computed_value (type, &nil_value_funcs, NULL);
+
+ return v;
+@}
+@end smallexample
+
+See the implementation of the @code{$_siginfo} convenience variable in
+@file{infrun.c} as a real example use of lval_computed.
+
+@end table
+
@node Stack Frames
@chapter Stack Frames
next prev parent reply other threads:[~2009-02-05 1:14 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 18:47 [0/2] " Pedro Alves
2009-01-12 18:49 ` Pedro Alves
2009-01-12 18:52 ` [1/2] " Pedro Alves
2009-01-12 19:40 ` Eli Zaretskii
2009-02-02 16:51 ` Pedro Alves
2009-02-02 21:04 ` Eli Zaretskii
2009-02-05 1:14 ` Pedro Alves [this message]
2009-02-05 20:30 ` Eli Zaretskii
2009-02-06 23:31 ` Pedro Alves
2009-01-12 18:50 ` [2/2] " Pedro Alves
2009-01-12 19:39 ` Eli Zaretskii
2009-01-13 12:32 ` Pedro Alves
2009-01-13 18:55 ` Eli Zaretskii
2009-01-13 19:08 ` Pedro Alves
2009-01-13 19:15 ` Eli Zaretskii
2009-02-06 23:35 ` Pedro Alves
2009-02-09 6:23 ` Paul Pluzhnikov
2009-02-09 22:17 ` Pedro Alves
2009-04-06 19:00 ` Paul Pluzhnikov
2009-04-06 19:18 ` relying on testsuite results Thiago Jung Bauermann
2009-04-06 19:33 ` Paul Pluzhnikov
2009-04-06 19:57 ` Daniel Jacobowitz
2009-04-06 19:51 ` Tom Tromey
2009-04-06 20:22 ` Mark Kettenis
2009-04-07 14:57 ` [2/2] Inspect extra signal information Pedro Alves
2009-01-12 23:27 ` [0/2] " Mark Kettenis
2009-01-13 11:05 ` Pedro Alves
2009-01-13 18:42 ` Eli Zaretskii
2009-01-13 18:50 ` Pedro Alves
2009-01-13 19:19 ` Eli Zaretskii
2009-01-13 19:37 ` Pedro Alves
2009-01-13 19:47 ` Pedro Alves
2009-02-02 14:40 ` Pedro Alves
2009-02-02 20:49 ` Mark Kettenis
2009-02-03 15:02 ` Pedro Alves
2009-02-03 16:42 ` Ulrich Weigand
2009-02-03 18:06 ` Daniel Jacobowitz
2009-02-03 18:24 ` Pedro Alves
2009-02-03 19:04 ` Daniel Jacobowitz
2009-02-03 19:51 ` Pedro Alves
2009-02-03 23:18 ` Doug Evans
2009-02-03 23:50 ` Pedro Alves
2009-02-04 0:17 ` Doug Evans
2009-02-04 0:24 ` Daniel Jacobowitz
2009-02-04 0:49 ` Pedro Alves
2009-02-04 21:02 ` [3/2] Inspect extra signal information, handle amd64 bi-arch gdb Pedro Alves
2009-02-04 21:17 ` Daniel Jacobowitz
2009-02-06 23:37 ` Pedro Alves
2009-02-07 2:28 ` Paul Pluzhnikov
2009-02-07 14:56 ` Pedro Alves
2009-02-07 16:14 ` Paul Pluzhnikov
2009-02-04 22:07 ` Doug Evans
2009-02-03 18:23 ` [0/2] Inspect extra signal information Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200902050114.05103.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox