From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9069A3858C53; Thu, 7 Apr 2022 00:54:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9069A3858C53 From: "simark at simark dot ca" To: gdb-prs@sourceware.org Subject: [Bug gdb/29034] New: Can't print macros defined on the command-line with binaries built with clang Date: Thu, 07 Apr 2022 00:54:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simark at simark dot ca X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2022 00:54:42 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29034 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=3D1 $ ./gdb -nx -q --data-directory=3Ddata-directory a.out -ex start -ex "p O= NE" -batch ... $1 =3D 1 Not with clang: $ clang --version clang version 13.0.1 $ clang test.c -g3 -O0 -fdebug-macro -DONE=3D1=20 $ ./gdb -nx -q --data-directory=3Ddata-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. --=20 You are receiving this mail because: You are on the CC list for the bug.=