This is the mail archive of the mailing list for the systemtap project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/18462] macro deprecation

--- Comment #4 from Martin Cermak <mcermak at redhat dot com> ---
Created attachment 8356
patch that seems to work for me

(In reply to Josh Stone from comment #3)
> Can you just change parse_library_macros to call scan_pp() instead?

This works in a sense, that the macro declaration surrounded by a conditional,
that evaluates to false, gets skipped. Also this doesn't cause any regression
in the (whole) testsuite. So far so good.

But when the unwanted macro is being skipped in skip_pp(), scan_pp1() gets
called, putting the macro into the pp1_namespace --- so later on the macro gets
inadvertently expanded anyway: 

 7.1 S x86_64 # cat /root/systemtap/blah/share/systemtap/tapset/linux/aaa.stpm
%( 1 == 2 %?
@define __mymacro
 7.1 S x86_64 # cat xxx.stp 
probe oneshot {
 7.1 S x86_64 # gdb -q -args stap -p1 -g xxx.stp 
Reading symbols from /root/systemtap/stap...done.
(gdb) b parse.cxx:484
Breakpoint 1 at 0x43ad3e: file parse.cxx, line 484.
(gdb) r
Starting program: /root/systemtap/stap -p1 -g xxx.stp
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/".

Breakpoint 1, parser::scan_pp1 (this=this@entry=0x7fffffffc490) at
484               macrodecl* decl = (pp1_namespace[name] = new macrodecl);
Missing separate debuginfos, use: ... stuff deleted ...
(gdb) bt
#0  parser::scan_pp1 (this=this@entry=0x7fffffffc490) at parse.cxx:484
#1  0x000000000043e318 in parser::skip_pp (this=this@entry=0x7fffffffc490) at
#2  0x000000000043e51e in parser::scan_pp (this=this@entry=0x7fffffffc490) at
#3  0x000000000043f597 in parser::parse_library_macros
(this=this@entry=0x7fffffffc490) at parse.cxx:721
#4  0x00000000004407bd in parse_library_macros (s=...,
name="/root/systemtap/blah/share/systemtap/tapset/linux/aaa.stpm") at
#5  0x0000000000412a47 in passes_0_4 (s=...) at main.cxx:567
#6  0x000000000040f45d in main (argc=<optimized out>, argv=<optimized out>) at

So what seems to fix the issue for me is to modify skip_pp() to call newly
created scan_pp1_temp(), which behaves like scan_pp1() except of putting stuff
into pp1_namespace. Using it, reference to a deprecated macro results in:

 7.1 S x86_64 # stap -p1 -g xxx.stp 
parse error: unknown operator @__mymacro
        saw: operator '@__mymacro' at xxx.stp:2:13
     source:     println(@__mymacro)

1 parse error.
Pass 1: parse failed.  [man error::pass1]
 7.1 S x86_64 #

Which looks about fine to me.

You are receiving this mail because:
You are the assignee for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]