From: Danny McClanahan <dmcc2@hypnicjerk.ai>
To: Pip Cet <pipcet@protonmail.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: [PATCH] add compiled regexp primitive lisp object
Date: Mon, 05 Aug 2024 07:15:52 +0000 [thread overview]
Message-ID: <7EQEmhENPbct4e7fqnnVl_rBcolGu5iTcySb7QtM-Z4O21LSTLGEU8Ya5KFhkQQalKpXHe1IgpOrfn0nyZuO-VQl3_XBBDHPab-6HY-KXrU=@hypnicjerk.ai> (raw)
In-Reply-To: <5He97LtsyeyQoTLU7d91oP2CLO8s_2afdgcNxozsFjzu8qGbB_7nXmsZL5O6Ej7K-tuEmngCcPKJpDAjxeKz4jk1DvqSUbdOLpw5U1vo1SY=@hypnicjerk.ai>
Regarding one comment from Pip's review:
> On Monday, August 5th, 2024 at 00:39, Danny McClanahan <dmcc2@hypnicjerk.ai> wrote:
> > > diff --git a/etc/emacs_lldb.py b/etc/emacs_lldb.py
> > > index ba80d3431f3..2a1fd238b17 100644
> > > --- a/etc/emacs_lldb.py
> > > +++ b/etc/emacs_lldb.py
> > > @@ -69,6 +69,7 @@ class Lisp_Object:
> > > "PVEC_MODULE_FUNCTION": "struct Lisp_Module_Function",
> > > "PVEC_NATIVE_COMP_UNIT": "struct Lisp_Native_Comp_Unit",
> > > "PVEC_SQLITE": "struct Lisp_Sqlite",
> > > + "PVEC_REGEXP": "struct Lisp_Regexp",
> > > "PVEC_COMPILED": "struct Lisp_Vector",
> > > "PVEC_CHAR_TABLE": "struct Lisp_Vector",
> > > "PVEC_SUB_CHAR_TABLE": "void",
> >
> > Can you also update .gdbinit?
>
>
> Will do!
Have never meddled with gdbinit before, but was able to get this working. Left
a couple TODOs as I'm going to focus on allocating `re_pattern_buffer' and
`re_registers' directly within the `Lisp_Regexp' and `Lisp_Match' objects as
opposed to requiring a new dynamic allocation (which will make pdumping easier
as well).
---
src/.gdbinit | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/.gdbinit b/src/.gdbinit
index 0f55cc18699..434dc909987 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -926,6 +926,54 @@ Set $ as a hash table pointer.
This command assumes that $ is an Emacs Lisp hash table value.
end
+# TODO: figure out how to print re_pattern_buffer!
+define xregexp
+ xgetptr $
+ print (struct Lisp_Regexp *) $ptr
+ xgetptr $->pattern
+ printf "pattern = %s\n", $ptr ? (char *) ((struct Lisp_String *) $ptr)->u.s.data : "DEAD"
+ printf "posix = %d\n", $->posix
+end
+document xregexp
+Set $ as a regexp pointer and print the pattern it was compiled from.
+This command assumes $ is an Emacs Lisp compiled regexp value.
+end
+
+# TODO: figure out how to print re_registers!
+define xmatch
+ xgetptr $
+ print (struct Lisp_Match *) $ptr
+ set $m = $
+ xgettype $m->haystack
+ xgetptr $m->haystack
+ set $h = $ptr
+ xgetptr Qnil
+ set $nil = $ptr
+ if $type == Lisp_String
+ print (struct Lisp_String *) $h
+ printf "haystack = \"%s\"\n", $h ? (char *) ((struct Lisp_String *) $h)->u.s.data : "DEAD"
+ end
+ if $type == Lisp_Vectorlike
+ set $size = ((struct Lisp_Vector *) $h)->header.size
+ if ($size & PSEUDOVECTOR_FLAG)
+ set $vec = (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS)
+ if $vec == PVEC_BUFFER
+ print (struct buffer *) $h
+ xgetptr $->name_
+ printf "haystack = <buffer \"%s\">\n", $ptr ? (char *) ((struct Lisp_String *) $ptr)->u.s.data : "DEAD"
+ end
+ end
+ end
+ if $h == $nil
+ printf "haystack = nil\n"
+ end
+ printf "initialized_regs = %ld\n", $m->initialized_regs
+end
+document xmatch
+Set $ as a regexp match pointer.
+This command assumes $ is an Emacs Lisp regexp match value.
+end
+
define xtsparser
xgetptr $
print (struct Lisp_TS_Parser *) $ptr
@@ -1099,6 +1147,12 @@ define xpr
if $vec == PVEC_HASH_TABLE
xhashtable
end
+ if $vec == PVEC_REGEXP
+ xregexp
+ end
+ if $vec == PVEC_MATCH
+ xmatch
+ end
if $vec == PVEC_TS_PARSER
xtsparser
end
next prev parent reply other threads:[~2024-08-05 7:15 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 5:08 [PATCH] add compiled regexp primitive lisp object Danny McClanahan
2024-07-30 13:02 ` Philip Kaludercic
2024-07-31 22:33 ` dmcc2
2024-08-01 1:04 ` Pip Cet
2024-08-04 23:38 ` Danny McClanahan
2024-08-05 3:47 ` dmcc2
2024-08-05 4:39 ` Danny McClanahan
2024-08-05 7:15 ` Danny McClanahan [this message]
2024-08-05 17:55 ` Pip Cet
2024-08-06 15:15 ` Danny McClanahan
2024-08-06 15:57 ` Eli Zaretskii
2024-08-07 4:28 ` Danny McClanahan
2024-08-06 18:18 ` Pip Cet
2024-08-06 18:38 ` Eli Zaretskii
2024-08-07 4:23 ` Danny McClanahan
2024-08-07 12:00 ` Eli Zaretskii
2024-08-07 12:43 ` Helmut Eller
2024-08-07 13:40 ` Augusto Stoffel
2024-08-07 15:23 ` Danny McClanahan
2024-08-14 1:32 ` Stefan Monnier
2024-08-07 15:02 ` Danny McClanahan
2024-08-07 15:23 ` Eli Zaretskii
2024-08-14 1:25 ` Stefan Monnier
2024-08-07 7:59 ` Danny McClanahan
2024-08-06 12:08 ` Eli Zaretskii
2024-08-01 8:30 ` Andrea Corallo
2024-08-01 10:06 ` Gerd Möllmann
2024-08-06 13:47 ` Danny McClanahan
2024-08-06 13:57 ` Danny McClanahan
2024-08-07 7:21 ` Andrea Corallo
2024-08-07 8:27 ` Danny McClanahan
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='7EQEmhENPbct4e7fqnnVl_rBcolGu5iTcySb7QtM-Z4O21LSTLGEU8Ya5KFhkQQalKpXHe1IgpOrfn0nyZuO-VQl3_XBBDHPab-6HY-KXrU=@hypnicjerk.ai' \
--to=dmcc2@hypnicjerk.ai \
--cc=emacs-devel@gnu.org \
--cc=pipcet@protonmail.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.