public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29034] New: Can't print macros defined on the command-line with binaries built with clang
@ 2022-04-07  0:54 simark at simark dot ca
  2022-04-08  0:01 ` [Bug macros/29034] " tromey at sourceware dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: simark at simark dot ca @ 2022-04-07  0:54 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29034
           Summary: Can't print macros defined on the command-line with
                    binaries built with clang
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

With a gcc-compiled binary, I can print a macro defined on the command line:

  $ gcc test.c -g3 -O0 -DONE=1
  $ ./gdb -nx -q --data-directory=data-directory a.out -ex start -ex "p ONE"
-batch
  ...
  $1 = 1

Not with clang:

    $ clang --version
clang version 13.0.1
    $ clang test.c -g3 -O0 -fdebug-macro -DONE=1 
    $ ./gdb -nx -q --data-directory=data-directory a.out -ex start -ex "p ONE"
-batch
    ...
    No symbol "ONE" in current context.

I think this is due to the fact that clang puts the macros defined on the
command-line too late in the macro table, after the main file.  So they are not
"in scope" when stopped somewhere in the main file or any file included by it
(so, anywhere really).

I opened this LLVM bug:

https://github.com/llvm/llvm-project/issues/54506

This bug is mostly to have a paper trail and be able to use a KFAIL in the
testsuite.

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

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

end of thread, other threads:[~2024-05-16 10:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07  0:54 [Bug gdb/29034] New: Can't print macros defined on the command-line with binaries built with clang simark at simark dot ca
2022-04-08  0:01 ` [Bug macros/29034] " tromey at sourceware dot org
2022-04-08  0:07 ` tromey at sourceware dot org
2022-04-18 19:17 ` blarsen at redhat dot com
2022-11-03 13:14 ` cvs-commit at gcc dot gnu.org
2024-01-19 13:20 ` aburgess at redhat dot com
2024-05-16 10:29 ` vries at gcc dot gnu.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).