From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B3E48389FC20; Fri, 18 Dec 2020 06:41:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3E48389FC20 From: "craig.ringer at 2ndquadrant dot com" To: systemtap@sourceware.org Subject: [Bug translator/25346] support enum context variables Date: Fri, 18 Dec 2020 06:41:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: craig.ringer at 2ndquadrant dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 06:41:29 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D25346 --- Comment #2 from Craig Ringer --- It's also worth noting that a lot of code uses #define macros not true enum= s . While embedded C blocks can #include C headers, they can only do so if the header is safe and sensible to compile as kernel code, with no reference to standard headers. For many programs this may not be feasible. At best, the macro definitions can be extracted into a separate mini-header= for systemtap use. An @enum that used DWARF debuginfo would be fantastic, but would only help = for true enums. If code is compiled with -ggdb3 it will include DWARF macro information too= . In that case, it becomes possible to look up the textual definitions of macro symbols, though recursive expansion is not trivial to handle in cases where= the macro is defined in terms of other macros. If the macro expansion can be us= ed as a valid C const-expression, it could be evaluated with an embedded-C expression and stored in a static constant, such that some @dwarf_macro("FO= O") or @dwarf_macro("FOO@bar.h") or @dwarf_macro("FOO","/path/to/program") for macro "#define FOO 1<<4" could expand to definition: %{ static const long _stap_macro_FOO =3D (1<<4); %} and where referenced expand to %{ _stap_macro_FOO %} . I had intended to tackle this after I got @enum working, but I got stuck tr= ying to work out how do make @enum work. --=20 You are receiving this mail because: You are the assignee for the bug.=