From: ludo@gnu.org (Ludovic Courtès)
To: Doug Evans <xdje42@gmail.com>
Cc: Doug Evans <dje@sebabeach.org>,
guile-user@gnu.org, gdb-patches@sourceware.org
Subject: Re: guile scripting for gdb
Date: Mon, 11 Nov 2013 12:47:51 +0100 [thread overview]
Message-ID: <871u2np3bs.fsf@gnu.org> (raw)
In-Reply-To: <CAP9bCMQVz1X_DnNQYQzEY4RnY6wCbUbjeO-T0MDtu=xO0FFBpQ@mail.gmail.com> (Doug Evans's message of "Sun, 10 Nov 2013 17:50:00 -0800")
Doug Evans <xdje42@gmail.com> skribis:
> On Sun, Nov 10, 2013 at 4:19 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>> Doug Evans <dje@sebabeach.org> skribis:
>>
>>> On Thu, Nov 7, 2013 at 3:39 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>>
>> [...]
>>
>>>> As discussed on IRC, one possible issue is eq?-ness of SMOBs: one would
>>>> usually expects pointer equality to be preserved at the Scheme level.
>>>
>>> Yeah.
>>> That'll require gdb maintaining its own table(s) for each kind of smob
>>> we want to intern.
>>> Definitely doable, though there are some issues.
>>> E.g., while std::vector<int> may be the same type in two different programs,
>>
>> What I had in mind was something simpler: suppose you have the very same
>> C struct pointer reaches the Scheme level, at two different points in
>> time, or via two different paths; currently gdb may end up allocating
>> two different SMOBs (i.e., two SMOBs that are not eq?), whereas I would
>> suggest making sure there’s only one SMOB.
>>
>> Example:
>>
>> --8<---------------cut here---------------start------------->8---
>> (gdb) guile (lookup-type "int")
>> #<gdb:type int>
>> (gdb) guile (arch-int-type (current-arch))
>> #<gdb:type int>
>> (gdb) guile (eq? (lookup-type "int") (arch-int-type (current-arch)))
>> #f
>> --8<---------------cut here---------------end--------------->8---
>>
>> Here I bet the underlying ‘struct type’ pointer return by ‘lookup-type’
>> is the same as that returned by ‘arch-int-type’, yet the SMOBs are
>> different.
>>
>> Fixing it would require maintaining a C->SMOB mapping.
>
> I'm pretty sure we have a sufficiently similar idea in mind.
> I mention the use of multiple tables because the lifetimes of
> different kinds of objects are different, and it may be easier to
> delete the table than iterate over each element looking for entries
> that need to be deleted.
>
> For reference sake, gdb doesn't guarantee that in the above example
> the underlying pointers are equal.
> While the arch provides a definition of "int" it can also come from
> the debug info in the program (actually there can and typically will
> be several copies, one from each .o in the program).
> eq-ness will be problematic even with the C->SMOB mapping.
Ah, OK. Indeed, eq?-ness only would only matter in cases where gdb
guarantees pointer equality in the first place.
Thanks for the explanation,
Ludo’.
next prev parent reply other threads:[~2013-11-11 11:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 16:00 guile scripting for gdb Doug Evans
2013-11-07 23:39 ` Ludovic Courtès
2013-11-09 18:40 ` Doug Evans
2013-11-09 19:50 ` Thien-Thi Nguyen
2013-11-09 20:33 ` Doug Evans
2013-11-11 0:19 ` Ludovic Courtès
2013-11-11 1:50 ` Doug Evans
2013-11-11 6:28 ` Doug Evans
2013-11-11 11:55 ` Ludovic Courtès
2013-11-11 11:47 ` Ludovic Courtès [this message]
2013-11-30 9:15 ` msematman
2013-12-02 3:49 ` Nala Ginrut
2013-12-02 12:10 ` extending guile programs thru python (or lua, or whatever ...) msematman
-- strict thread matches above, loose matches on Subject: below --
2013-11-04 15:57 guile scripting for gdb Doug Evans
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871u2np3bs.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=dje@sebabeach.org \
--cc=gdb-patches@sourceware.org \
--cc=guile-user@gnu.org \
--cc=xdje42@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).