public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18888] New: unable to evaluate NULL
@ 2015-08-28 21:49 msebor at redhat dot com
  2022-04-02 16:48 ` [Bug c++/18888] " tromey at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: msebor at redhat dot com @ 2015-08-28 21:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18888

            Bug ID: 18888
           Summary: unable to evaluate NULL
           Product: gdb
           Version: 7.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: msebor at redhat dot com
  Target Milestone: ---

GNU gdb (GDB) Fedora 7.8.2-38.fc21 doesn't seem to know about GCC's __null
extension used to implement the NULL macro.  When the NULL macro is used in the
definition of a function like macro as happens to be the case with some of the
GCC tree checking macros such as DECL_ASSEMBLER_NAME_SET_P, GDB issues the
cryptic error 'No symbol "__null" in current context.' when an attempt is to
evaluate an invocation of the macro.  This makes GCC debugging harder than it
would be otherwise.

(gdb) p DECL_ASSEMBLER_NAME_SET_P(expr)
No symbol "__null" in current context.

Test case:

$ cat t.c && g++ -g3 t.c && gdb -batch -ex 'b main' -ex 'r' -ex 'macro expand
FOO(p, 1, 2)' -ex 'p FOO(p, 1, 2)' a.out
#include <stdlib.h>

#define FOO(a, b, c)  a == NULL ? b : c

int main ()
{
    void *p = NULL;
    int n;
    n = FOO (p, 1, 2);
    return n;
}
Breakpoint 1 at 0x4005ba: file t.c, line 7.

Breakpoint 1, main () at t.c:7
7           void *p = NULL;
expands to: p == __null ? 1 : 2
No symbol "__null" in current context.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug c++/18888] unable to evaluate NULL
  2015-08-28 21:49 [Bug c++/18888] New: unable to evaluate NULL msebor at redhat dot com
@ 2022-04-02 16:48 ` tromey at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2022-04-02 16:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18888

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
See also bug #15243, about nullptr.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2022-04-02 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-28 21:49 [Bug c++/18888] New: unable to evaluate NULL msebor at redhat dot com
2022-04-02 16:48 ` [Bug c++/18888] " tromey at sourceware dot org

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