From: ludo@gnu.org (Ludovic Courtès)
To: Doug Evans <dje@sebabeach.org>
Cc: guile-user@gnu.org, gdb-patches@sourceware.org
Subject: Re: guile scripting for gdb
Date: Mon, 11 Nov 2013 01:50:00 -0000 [thread overview]
Message-ID: <87k3gfpz7k.fsf@gnu.org> (raw)
In-Reply-To: <CAA8o+=Qhwj720CtfhUF=JuLs-GJ455uZ7gsRRripc=4vZDFWng@mail.gmail.com> (Doug Evans's message of "Sat, 9 Nov 2013 10:40:18 -0800")
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.
> if we want eq?-ness to survive across the lifetime of the underlying gdb object
> then that would take extra effort to make that work.
> Would it be ok to punt on eq?-ness until there's a compelling reason
> to make it work?
Yes, a lot can already be done with the current semantics, but at some
point it may break the user’s expectations. It’s natural to compare
presumably-pointer-identical objects with eq?, or to use eq? hash
tables.
[...]
>> An interesting exercise would be to write pretty-printers for SCM values
>> and tools to walk Guile’s VM stack (like Guile’s gdbinit attempts to do).
>
> Agreed, excellent exercises.
>
> gdb has a "frame filter" interface that's intended to be used to
> implement multi-language backtraces.
That sounds cool. If gdb could show trace mixing both stacks, that’d be
nice.
> Need to add a gdb/guile interface.
> I'm not sure how Guile's new VM changes things - someone may want to
> write one for 2.0 and one for 2.2.
Yeah, the VM in 2.2 is completely different.
Thanks,
Ludo’.
next prev parent reply other threads:[~2013-11-11 0:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 16:04 Doug Evans
[not found] ` <87ob5vlr2s.fsf@gnu.org>
2013-11-09 19:47 ` Doug Evans
2013-11-09 19:48 ` Thien-Thi Nguyen
2013-11-10 6:26 ` Doug Evans
2013-11-11 1:50 ` Ludovic Courtès [this message]
2013-11-11 6:28 ` Doug Evans
2013-11-11 6:37 ` Doug Evans
2013-11-11 13:16 ` Ludovic Courtès
2013-11-11 11:55 ` Ludovic Courtès
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=87k3gfpz7k.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=dje@sebabeach.org \
--cc=gdb-patches@sourceware.org \
--cc=guile-user@gnu.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