public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/18888] New: unable to evaluate NULL
Date: Fri, 28 Aug 2015 21:49:00 -0000	[thread overview]
Message-ID: <bug-18888-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-08-28 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 21:49 msebor at redhat dot com [this message]
2022-04-02 16:48 ` [Bug c++/18888] " tromey at sourceware dot org

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=bug-18888-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).