Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Matt Rice <ratmice@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Siva Chandra <sivachandra@google.com>, gdb-patches@sourceware.org
Subject: Re: [RFC - Python Scripting] New method gdb.Architecture.disassemble
Date: Wed, 06 Feb 2013 22:31:00 -0000	[thread overview]
Message-ID: <CACTLOFqWqO5tT9n1qWX2SuaS2ys8xsPXxkrys_5oWBbD8_vGxQ@mail.gmail.com> (raw)
In-Reply-To: <87y5f1w6xc.fsf@fleche.redhat.com>

On 2/6/13, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Siva" == Siva Chandra <sivachandra@google.com> writes:

> Siva> +/* This data structure captures the Python version of ui_out.  The
> Python
> Siva> +   version is not used to display output to a user, but to capture
> the results
> Siva> +   from GDB's internals in to a Python data structure.  Hence, it
> does not have
> Siva> +   any representation for table headers.  However, it can be viewed
> as a
> Siva> +   recursive table structure wherin the highest level is a list of
> rows.  All
> Siva> +   rows in this list can either be a list themselves, or all of them
> can be
> Siva> +   dicts holding the table's fields.  If they were lists, then they
> follow the
> Siva> +   same recurrsive structure as the higher levels.
>
> Typo, "recursive".
>
> I like this -- I've wanted it before -- but I wonder whether it handles
> all cases.  See http://sourceware.org/bugzilla/show_bug.cgi?id=11688#c6

these may help, not sure i'll try to be a little bit more pointed in
identifying the sources of the problems disregarding the details of
that specific patches attempt to paper around them:

http://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax

value ==>
    const | tuple | list
result ==>
    variable "=" value
list ==>
    "[]" | "[" value ( "," value )* "]" | "[" result ( "," result )* "]"
Notes:
New gdb/mi commands should only output lists containing values.

---

so, list can look like:
[1, 2, 3] or ["a" = 1, "b" = 2, "c" = 3]

both are created with a ui_out_type_list
thus we don't know if to create a python dict or list, until something is added,
and the existence of a fldname

then a 2nd issue entirely separate is that:
["a" = 1, "a" = 2, "a" = 3] is also valid and seen in practice

so sanely working around those issues is where the thoughts on adding
new uiout types comes from.


+static void
+py_out_field_string (struct ui_out * ui_out, int fldno, int width,
+                     enum ui_align align, const char *fldname, const char *str)
+{
+  struct py_out_data *py_out_data = ui_out_data (ui_out);
+
+  CHECK_AND_INIT_FIELD_ROW_DATA (py_out_data->current_row->data);
+
+  PyDict_SetItemString (py_out_data->current_row->data, fldname,
+                        PyString_FromString (str));
+}

need to test that 'fldname' isn't null, this should happen for the
[value, value] type of list.

PyDict_SetItemString:
the key object is created using PyString_FromString(key)
PyString_FromString:
The parameter v must not be NULL

my main concern is to do our best to make the datastructure returned
compatible with some future implementation of py-out which can handle
everything uiout throws at it.
then ask when uiout throws some new found nonsensical junk at us how
do we handle it?
not to dissuade from using an incomplete solution.

I suppose i'd be happy if the user had to create a py-uiout object
(passing in a version to the creation function), then passed that to
the dissasemble() function, but I dunno if the user really would.


  parent reply	other threads:[~2013-02-06 22:31 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 14:09 Siva Chandra
2013-02-05 23:28 ` Doug Evans
2013-02-06  1:53   ` Siva Chandra
2013-02-06 20:00     ` Tom Tromey
2013-02-08 18:05     ` Doug Evans
2013-02-09 17:55       ` Matt Rice
2013-02-12 14:56       ` Siva Chandra
2013-02-12 21:18         ` Tom Tromey
2013-02-13 14:37           ` Siva Chandra
2013-02-13 17:52             ` Eli Zaretskii
2013-02-13 18:03             ` Tom Tromey
2013-02-13 19:50               ` Siva Chandra
2013-02-13 20:42                 ` Doug Evans
2013-02-14 22:46                   ` Siva Chandra
2013-02-15  6:43                     ` Doug Evans
2013-02-15 17:32                       ` Doug Evans
2013-02-15 17:40                         ` Siva Chandra
2013-02-15 17:41                           ` Siva Chandra
2013-02-15 18:57                           ` Doug Evans
2013-02-15 20:36                       ` Siva Chandra
2013-02-15 21:01                         ` Siva Chandra
2013-02-16  5:30                           ` Doug Evans
2013-02-16  8:47                           ` Eli Zaretskii
2013-02-19  5:36                             ` Siva Chandra
2013-02-19 15:51                               ` Paul_Koning
2013-02-19 16:35                                 ` Eli Zaretskii
2013-02-19 16:38                               ` Eli Zaretskii
2013-02-20 12:34                                 ` Siva Chandra
2013-02-20 18:44                                   ` Eli Zaretskii
2013-02-21  1:49                                     ` Siva Chandra
2013-02-06 19:58 ` Tom Tromey
2013-02-06 20:31   ` Phil Muldoon
2013-02-06 22:31   ` Matt Rice [this message]
2013-02-06 23:19     ` Siva Chandra
2013-02-07  1:11       ` Siva Chandra
2013-02-07 23:03         ` Matt Rice
     [not found]       ` <20130206235707.GA2353@klara.mpi.htwm.de>
2013-02-07  1:18         ` Siva Chandra
2013-02-07 14:14   ` Siva Chandra
2013-02-07 16:42     ` Tom Tromey

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=CACTLOFqWqO5tT9n1qWX2SuaS2ys8xsPXxkrys_5oWBbD8_vGxQ@mail.gmail.com \
    --to=ratmice@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sivachandra@google.com \
    --cc=tromey@redhat.com \
    /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