unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Can't set conditional break point using AREF/NILP
       [not found]         ` <83v8z4eygg.fsf@gnu.org>
@ 2022-01-01 21:49           ` Sean Whitton
  2022-01-02  6:42             ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Whitton @ 2022-01-01 21:49 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel

[moving to emacs-devel]

On Sat 01 Jan 2022 at 08:56AM +02, Eli Zaretskii wrote:

>> From: Sean Whitton <spwhitton@spwhitton.name>
>> Date: Fri, 31 Dec 2021 17:30:35 -0700
>>
>> If I might ask a gdb question: to try to determine when this code can
>> set FONT_WEIGHT_INDEX to nil, I set a breakpoint right after it and then
>> tried
>>
>>     condition NN NILP (AREF (entity, FONT_WEIGHT_INDEX))
>>
>> but this didn't work -- is it possible to do something like that?
>
> It should be possible if your Emacs was compiled with -g3.

Can confirm mine is.

> Perhaps try
>
>   condition NN AREF (entity, FONT_WEIGHT_INDEX) == Qnil
>
> instead.

This fails in the same way.  This is what I see:

Breakpoint 2 at 0x335d30: file ftfont.c, line 231.
(gdb) condition 2 AREF (entity, FONT_WEIGHT_INDEX) == Qnil
(gdb) r
`/home/spwhitton/src/emacs/src/emacs' has changed; re-reading symbols.
Starting program: /home/spwhitton/src/emacs/src/emacs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff15c4700 (LWP 2073615)]
[New Thread 0x7ffff0bca700 (LWP 2073616)]
[New Thread 0x7fffebfff700 (LWP 2073617)]
[New Thread 0x7fffeb254700 (LWP 2073618)]
[New Thread 0x7fffea8c3700 (LWP 2073619)]
[New Thread 0x7fffe9f32700 (LWP 2073620)]
Error in testing breakpoint condition:
Couldn't get registers: No such process.
An error occurred while in a function called from GDB.
Evaluation of the expression containing the function
(AREF) will be abandoned.
When the function is done executing, GDB will silently stop.
Selected thread is running.
(gdb) [Switching to thread 1 (Thread 0x7ffff237b040 (LWP 2073608))]
#0  ftfont_pattern_entity (p=0x55555643d660, extra=XIL(0x555555f91953)) at ftfont.c:230
230	  if (FcPatternGetInteger (p, FC_SLANT, 0, &numeric) == FcResultMatch)

And then gdb does break at the break point, but it's badly broken:

(gdb) p AREF (entity, FONT_WEIGHT_INDEX) == Qnil
[Thread 0x7fffea8c3700 (LWP 2073619) exited]
[Thread 0x7fffe9f32700 (LWP 2073620) exited]
Attempt to take address of value not located in memory.
(gdb)

-- 
Sean Whitton



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can't set conditional break point using AREF/NILP
  2022-01-01 21:49           ` Can't set conditional break point using AREF/NILP Sean Whitton
@ 2022-01-02  6:42             ` Eli Zaretskii
  2022-01-02 22:38               ` Sean Whitton
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-01-02  6:42 UTC (permalink / raw)
  To: Sean Whitton; +Cc: emacs-devel

> From: Sean Whitton <spwhitton@spwhitton.name>
> Date: Sat, 01 Jan 2022 14:49:05 -0700
> 
> >>     condition NN NILP (AREF (entity, FONT_WEIGHT_INDEX))
> >>
> >> but this didn't work -- is it possible to do something like that?
> >
> > It should be possible if your Emacs was compiled with -g3.
> 
> Can confirm mine is.
> 
> > Perhaps try
> >
> >   condition NN AREF (entity, FONT_WEIGHT_INDEX) == Qnil
> >
> > instead.
> 
> This fails in the same way.  This is what I see:
> 
> Breakpoint 2 at 0x335d30: file ftfont.c, line 231.
> (gdb) condition 2 AREF (entity, FONT_WEIGHT_INDEX) == Qnil
> (gdb) r
> `/home/spwhitton/src/emacs/src/emacs' has changed; re-reading symbols.
> Starting program: /home/spwhitton/src/emacs/src/emacs
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> [New Thread 0x7ffff15c4700 (LWP 2073615)]
> [New Thread 0x7ffff0bca700 (LWP 2073616)]
> [New Thread 0x7fffebfff700 (LWP 2073617)]
> [New Thread 0x7fffeb254700 (LWP 2073618)]
> [New Thread 0x7fffea8c3700 (LWP 2073619)]
> [New Thread 0x7fffe9f32700 (LWP 2073620)]
> Error in testing breakpoint condition:
> Couldn't get registers: No such process.

This error message already says it won't work, although I don't
understand why.  The "No such process" part is especially worrisome.
It works here, FWIW.

What version of GDB is that, and was it built with Python support?
I have GDB 11.1 here.

Also, did you perhaps use the --enable-check-lisp-object-type
configure-time switch?  If so, please rebuild without it.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can't set conditional break point using AREF/NILP
  2022-01-02  6:42             ` Eli Zaretskii
@ 2022-01-02 22:38               ` Sean Whitton
  2022-01-03 12:28                 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Whitton @ 2022-01-02 22:38 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel

Hello,

On Sun 02 Jan 2022 at 08:42AM +02, Eli Zaretskii wrote:

> What version of GDB is that, and was it built with Python support?
> I have GDB 11.1 here.

I have the one in Debian bullseye: GNU gdb (Debian 10.1-1.7)
10.1.90.20210103-git.  Looks like it has Python support:

    ~ % gdb --configuration | grep python
                 --with-python=/usr (relocatable)
                 --with-python-libdir=/usr/lib (relocatable)

> Also, did you perhaps use the --enable-check-lisp-object-type
> configure-time switch?  If so, please rebuild without it.

I did have that on, but removing it does not help.  I did

    ./configure
        --config-cache --with-native-compilation --with-pgtk
        --enable-checking='yes,glyphs' CFLAGS='-O0 -g3' && make

and I get a similar-looking error:

    Breakpoint 2 at 0x345830: file ftfont.c, line 230.
    (gdb) condition 2 AREF (entity, FONT_WEIGHT_INDEX) == Qnil
    (gdb) r
    Starting program: /home/spwhitton/src/emacs/src/emacs 
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    [New Thread 0x7fffef6a2700 (LWP 2427493)]
    [New Thread 0x7fffee7a8700 (LWP 2427494)]
    [New Thread 0x7fffeddee700 (LWP 2427495)]
    [New Thread 0x7fffed032700 (LWP 2427496)]
    [New Thread 0x7fffdffff700 (LWP 2427497)]
    [New Thread 0x7fffdf66e700 (LWP 2427498)]
    Error in testing breakpoint condition:
    Couldn't get registers: No such process.
    An error occurred while in a function called from GDB.
    Evaluation of the expression containing the function
    (AREF) will be abandoned.
    When the function is done executing, GDB will silently stop.
    Selected thread is running.
    (gdb) [Switching to thread 1 (Thread 0x7ffff046e400 (LWP 2427486))]
    #0  ftfont_pattern_entity (p=0x5555564dff20, extra=XIL(0x55555620bdf3)) at ftfont.c:230
    230	  if (FcPatternGetInteger (p, FC_SLANT, 0, &numeric) == FcResultMatch)

-- 
Sean Whitton



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can't set conditional break point using AREF/NILP
  2022-01-02 22:38               ` Sean Whitton
@ 2022-01-03 12:28                 ` Eli Zaretskii
  2022-01-04 21:57                   ` Sean Whitton
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-01-03 12:28 UTC (permalink / raw)
  To: Sean Whitton; +Cc: emacs-devel

> From: Sean Whitton <spwhitton@spwhitton.name>
> Date: Sun, 02 Jan 2022 15:38:52 -0700
> 
>     ./configure
>         --config-cache --with-native-compilation --with-pgtk
>         --enable-checking='yes,glyphs' CFLAGS='-O0 -g3' && make
> 
> and I get a similar-looking error:
> 
>     Breakpoint 2 at 0x345830: file ftfont.c, line 230.
>     (gdb) condition 2 AREF (entity, FONT_WEIGHT_INDEX) == Qnil
>     (gdb) r
>     Starting program: /home/spwhitton/src/emacs/src/emacs 
>     [Thread debugging using libthread_db enabled]
>     Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>     [New Thread 0x7fffef6a2700 (LWP 2427493)]
>     [New Thread 0x7fffee7a8700 (LWP 2427494)]
>     [New Thread 0x7fffeddee700 (LWP 2427495)]
>     [New Thread 0x7fffed032700 (LWP 2427496)]
>     [New Thread 0x7fffdffff700 (LWP 2427497)]
>     [New Thread 0x7fffdf66e700 (LWP 2427498)]
>     Error in testing breakpoint condition:
>     Couldn't get registers: No such process.
>     An error occurred while in a function called from GDB.
>     Evaluation of the expression containing the function
>     (AREF) will be abandoned.
>     When the function is done executing, GDB will silently stop.
>     Selected thread is running.

Then maybe it's a problem with your system architecture, and you need
to expand the macro "by hand" for GDB to swallow it.  Sorry I couldn't
be of more help.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can't set conditional break point using AREF/NILP
  2022-01-03 12:28                 ` Eli Zaretskii
@ 2022-01-04 21:57                   ` Sean Whitton
  2022-01-05 12:11                     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Whitton @ 2022-01-04 21:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Hello,

On Mon 03 Jan 2022 at 02:28PM +02, Eli Zaretskii wrote:

> Then maybe it's a problem with your system architecture, and you need
> to expand the macro "by hand" for GDB to swallow it.  Sorry I couldn't
> be of more help.

No problem.  Next time, I'll try expanding the macro by hand.

When you asked me to remove --enable-check-lisp-object-type, was that
purely for debugging purposes, or is using the macros in break point
conditions with that switch on expected not to work?  If the latter, I'd
like to document it in etc/DEBUG.

Ftr my system is very standard Debian bullseye.

-- 
Sean Whitton



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can't set conditional break point using AREF/NILP
  2022-01-04 21:57                   ` Sean Whitton
@ 2022-01-05 12:11                     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-01-05 12:11 UTC (permalink / raw)
  To: Sean Whitton; +Cc: emacs-devel

> From: Sean Whitton <spwhitton@spwhitton.name>
> Cc: emacs-devel@gnu.org
> Date: Tue, 04 Jan 2022 14:57:32 -0700
> 
> When you asked me to remove --enable-check-lisp-object-type, was that
> purely for debugging purposes, or is using the macros in break point
> conditions with that switch on expected not to work?  If the latter, I'd
> like to document it in etc/DEBUG.

Comparisons with structures, like foo == Qnil, aren't guaranteed to
work in GDB.  --enable-check-lisp-object-type makes Lisp objects be
structures rather than simple scalar values.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-05 12:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87zgoi8xve.fsf@melete.silentflame.com>
     [not found] ` <83r19uim2q.fsf@gnu.org>
     [not found]   ` <871r1uyq1i.fsf@athena.silentflame.com>
     [not found]     ` <8335mahr8f.fsf@gnu.org>
     [not found]       ` <87v8z4mh5g.fsf@melete.silentflame.com>
     [not found]         ` <83v8z4eygg.fsf@gnu.org>
2022-01-01 21:49           ` Can't set conditional break point using AREF/NILP Sean Whitton
2022-01-02  6:42             ` Eli Zaretskii
2022-01-02 22:38               ` Sean Whitton
2022-01-03 12:28                 ` Eli Zaretskii
2022-01-04 21:57                   ` Sean Whitton
2022-01-05 12:11                     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).