Giter Site home page Giter Site logo

pmachata / dwgrep Goto Github PK

View Code? Open in Web Editor NEW
51.0 10.0 10.0 4.43 MB

a tool for querying Dwarf (debuginfo) graphs

Home Page: http://pmachata.github.io/dwgrep/

License: GNU General Public License v3.0

CMake 1.60% C++ 87.89% Awk 0.65% Shell 4.45% C 4.05% Tcl 0.40% Assembly 0.97%

dwgrep's Introduction

dwgrep is a tool for querying Dwarf (debuginfo) graphs.  Queries are
written in a language called Zwerg, the syntax of which is described
in doc/syntax.rst.  The engine itself is available as a shared library
which can be used from C.

Full documentation is available in the doc/ sub-directory.  In particular,
check out <doc/index.rst>.  An HTML rendition of the full documentation is
published at <http://pmachata.github.io/dwgrep/>.

dwgrep's People

Contributors

cuviper avatar jwakely avatar pmachata avatar scottt avatar tromey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dwgrep's Issues

F21 vmlinux hits garbage ranges

I encountered this error:

$ dwgrep -e entry /usr/lib/debug/lib/modules/3.18.5-201.fc21.x86_64/vmlinux
[b]     compile_unit
        stmt_list (data4)       0;
        ranges (data4)  Error: invalid DWARF
$ echo $?
2

That CU as shown by eu-readelf is:

 [Offset]
 Compilation unit at offset 0:
 Version: 2, Abbreviation section offset: 0, Address size: 8, Offset size: 4
 [     b]  compile_unit
           stmt_list            (data4) 0
           ranges               (data4) range list [     0]
           name                 (string) "arch/x86/kernel/head_64.S"
           comp_dir             (string) "/usr/src/debug////////kernel-3.18.fc21/linux-3.18.5-201.fc21.x86_64"
           producer             (string) "GNU AS 2.24"
           language             (data2) Mips_Assembler (32769)

The next CU has range list 250, so this one contains:

DWARF section [38] '.debug_ranges' at offset 0x9c6a570:
 [     0]  base address 000000000000000000 <irq_stack_union>
 [    10]  <UNUSED GARBAGE> ... 48 bytes ...
 [    40]  0xffffffff81d4b222 <reset_early_page_tables+0x1d>..0xffffffff81d4b248 <reset_early_page_tables+0x43>
           0xffffffff81d4b252 <reset_early_page_tables+0x4d>..0xffffffff81d4b255 <reset_early_page_tables+0x50>
 [    70]  0xffffffff81d4b36a <early_make_pgtable+0x6a>..0xffffffff81d4b372 <early_make_pgtable+0x72>
           0xffffffff81d4b376 <early_make_pgtable+0x76>..0xffffffff81d4b37a <early_make_pgtable+0x7a>
 [    a0]  0xffffffff81d4b484 <early_make_pgtable+0x184>..0xffffffff81d4b488 <early_make_pgtable+0x188>
           0xffffffff81d4b495 <early_make_pgtable+0x195>..0xffffffff81d4b49b <early_make_pgtable+0x19b>
 [    d0]  0xffffffff81d4b4e5 <x86_64_start_kernel+0xc>..0xffffffff81d4b4e9 <x86_64_start_kernel+0x10>
           0xffffffff81d4b52c <x86_64_start_kernel+0x53>..0xffffffff81d4b584 <x86_64_start_kernel+0xab>
 [   100]  0xffffffff81d4b4e5 <x86_64_start_kernel+0xc>..0xffffffff81d4b4e9 <x86_64_start_kernel+0x10>
           0xffffffff81d4b550 <x86_64_start_kernel+0x77>..0xffffffff81d4b557 <x86_64_start_kernel+0x7e>
           0xffffffff81d4b55f <x86_64_start_kernel+0x86>..0xffffffff81d4b562 <x86_64_start_kernel+0x89>
           0xffffffff81d4b566 <x86_64_start_kernel+0x8d>..0xffffffff81d4b570 <x86_64_start_kernel+0x97>
 [   150]  0xffffffff81d4b52c <x86_64_start_kernel+0x53>..0xffffffff81d4b550 <x86_64_start_kernel+0x77>
           0xffffffff81d4b557 <x86_64_start_kernel+0x7e>..0xffffffff81d4b55f <x86_64_start_kernel+0x86>
           0xffffffff81d4b562 <x86_64_start_kernel+0x89>..0xffffffff81d4b566 <x86_64_start_kernel+0x8d>
 [   190]  0xffffffff81d4b4f1 <x86_64_start_kernel+0x18>..0xffffffff81d4b4f4 <x86_64_start_kernel+0x1b>
           0xffffffff81d4b510 <x86_64_start_kernel+0x37>..0xffffffff81d4b52c <x86_64_start_kernel+0x53>
 [   1c0]  0xffffffff81d4b584 <x86_64_start_kernel+0xab>..0xffffffff81d4b58b <x86_64_start_kernel+0xb2>
           0xffffffff81d4b5a1 <x86_64_start_kernel+0xc8>..0xffffffff81d4b5a4 <x86_64_start_kernel+0xcb>
           0xffffffff81d4b5ac <x86_64_start_kernel+0xd3>..0xffffffff81d4b5af <x86_64_start_kernel+0xd6>
           0xffffffff81d4b5b3 <x86_64_start_kernel+0xda>..0xffffffff81d4b5c1 <x86_64_start_kernel+0xe8>
 [   210]  0xffffffff81d4b58b <x86_64_start_kernel+0xb2>..0xffffffff81d4b5a1 <x86_64_start_kernel+0xc8>
           0xffffffff81d4b5a4 <x86_64_start_kernel+0xcb>..0xffffffff81d4b5ac <x86_64_start_kernel+0xd3>
           0xffffffff81d4b5af <x86_64_start_kernel+0xd6>..0xffffffff81d4b5b3 <x86_64_start_kernel+0xda>

I suppose the "garbage" is the issue tripping up dwgrep...

Constant domains need docstring

Currently the only documentation that we get for constants is something along the lines of "@DW_TAG_". There should be a full docstring.

We can stash the full docstring to each constant and rely on the compile to deduplicate the literals, and then on docgen to merge all the constants with the same docstring to the same section--both should work.

It might however make sense to add docstring support directly to constant domains, I'm not sure. That would allow us to document also domains that don't contain named constants, such as "hex", "address" or "column".

Add symbol table support

This needs a new value type, T_ELFSYM. The following words are related:

symbol :: T_DWARF ->* T_ELFSYM
  Yields symbols from all symbol tables (.dynsym, .symtab, minisymtab).

label :: T_ELFSYM -> T_CONST
  Yields a constant from domain STT_*.  That domain needs to be added.

value, address :: T_ELFSYM -> T_ASET
  Yields a constant with address domain identifying symbol address.

name :: T_ELFSYM -> T_STR
  Yields symbol name.

size :: T_ELFSYM -> T_CONST
  Yields symbol size.

bind :: T_ELFSYM -> T_CONST
  Yields symbol binding as a constant with domain STB_*.  That domain needs to be added.

visibility :: T_ELFSYM -> T_CONST
  Yields symbol visibility as a constant with domain STV_*.  That domain needs to be added.

Missing in that list is at least access to section index. That probably makes no sense to add on its own, but if we ever support ELF sections as value types, there would be a word section that yields the associated section.

Evaluation of long chains of "+" takes disproportionally long time.

$ time ./dwgrep/dwgrep '()*******************'

real    0m0.006s
user    0m0.006s
sys 0m0.000s
$ time ./dwgrep/dwgrep '()+++++++++++++++++++'

real    0m6.406s
user    0m6.052s
sys 0m0.362s

It looks quadratic in number of +'s. X+ is translated as XX*, I suspect the long chain of +'s simply leads to a huge number of X instances.

docgen should list words applicable to individual types

Vocabulary documentation currently shows all data types associated with the given vocabulary. It would be nice if it also showed what words are applicable to that type, in a nice compact list with hyperlinks. It might also be possible to show a separate list of "producers", i.e. words that yield values of that type.

Errors during execution should be communicated through the API

The errors such as this one:

$ ./dwgrep/dwgrep ./dwgrep/dwgrep -e 'attribute'
Error: `attribute' expects T_DIE or T_ABBREV near TOS.  Actual profile is T_DWARF.

... are currently simply dumped to stderr. They should be returned in zw_error instead.

entry::T_ATTR should exist

This is useful for figuring out which DIE an attribute comes from. Like `foo bar baz attribute ?DW_AT_blah entry'.

Automatically make use of .gnu_debuglink where possible

It would be convenient when dwgrep didn't find the debug_* sections but did find a .gnu_debuglink section it would make use of the .gnu_debuglink and find the separate debug info file like gdb and tools do. This would make it much easier to use dwgrep on binaries in Linux distributions such as Fedora.

selector.hh:91:49: error: request for member 'code' in 'vts#0', which is of non-class type 'cmp_result'

While re-building dwgrep package for ALT Linux we got a build failure:

+ mkdir -p x86_64-alt-linux
+ cmake -DCMAKE_SKIP_INSTALL_RPATH:BOOL=yes '-DCMAKE_C_FLAGS:STRING=-pipe -frecord-gcc-switches -Wall -g -O2' '-DCMAKE_CXX_FLAGS:STRING=-pipe -frecord-gcc-switches -Wall -g -O2' '-DCMAKE_Fortran_FLAGS:STRING=-pipe -frecord-gcc-switches -Wall -g -O2' -DCMAKE_INSTALL_PREFIX=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_DESTINATION=lib64 -DLIB_SUFFIX=64 -S . -B x86_64-alt-linux -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3
...
builder@x86_64:~/RPM/BUILD/dwgrep-0.4$ cmake --build x86_64-alt-linux --verbose
...
[ 70%] Building CXX object libzwerg/CMakeFiles/test-value-cst.dir/test-value-cst.cc.o
cd /usr/src/RPM/BUILD/dwgrep-0.4/x86_64-alt-linux/libzwerg && /usr/bin/c++  -I/usr/src/RPM/BUILD/dwgrep-0.4/libzwerg -I/usr/src/RPM/BUILD/dwgrep-0.4/x86_64-alt-linux -I/usr/src/RPM/BUILD/dwgrep-0.4/x86_64-alt-linux/libzwerg -pipe -frecord-gcc-switches -Wall -g -O2 -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -o CMakeFiles/test-value-cst.dir/test-value-cst.cc.o -c /usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc
In file included from /usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/stack.hh:38,
                 from /usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/op.hh:37,
                 from /usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/value-cst.hh:34,
                 from /usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc:30:
/usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/selector.hh: In instantiation of 'selector::selector(Ts ...) [with Ts = {cmp_result}; typename std::enable_if<(sizeof... (Ts) <= selector::W), int>::type Fake = 0]':
/usr/include/gtest/gtest-printers.h:215:9:   required from 'static void testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const T&, std::ostream*) [with T = cmp_result; <template-parameter-1-2> = void; <template-parameter-1-3> = std::basic_ostream<char>&; std::ostream = std::basic_ostream<char>]'
/usr/include/gtest/gtest-printers.h:312:22:   required from 'void testing::internal::PrintWithFallback(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]'
/usr/include/gtest/gtest-printers.h:441:30:   required from 'void testing::internal::PrintTo(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]'
/usr/include/gtest/gtest-printers.h:691:12:   required from 'static void testing::internal::UniversalPrinter<T>::Print(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]'
/usr/include/gtest/gtest-printers.h:980:30:   required from 'void testing::internal::UniversalPrint(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]'
/usr/include/gtest/gtest-printers.h:865:19:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/gtest/gtest-printers.h:334:36:   required from 'static std::string testing::internal::FormatForComparison<ToPrint, OtherOperand>::Format(const ToPrint&) [with ToPrint = cmp_result; OtherOperand = cmp_result; std::string = std::__cxx11::basic_string<char>]'
/usr/include/gtest/gtest-printers.h:415:45:   required from 'std::string testing::internal::FormatForComparisonFailureMessage(const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result; std::string = std::__cxx11::basic_string<char>]'
/usr/include/gtest/gtest.h:1527:53:   required from 'testing::AssertionResult testing::internal::CmpHelperEQFailure(const char*, const char*, const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result]'
/usr/include/gtest/gtest.h:1549:28:   required from 'testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result]'
/usr/include/gtest/gtest.h:1564:23:   required from 'static testing::AssertionResult testing::internal::EqHelper::Compare(const char*, const char*, const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result; typename std::enable_if<((! std::is_integral<_Tp>::value) || (! std::is_pointer<_Dp>::value))>::type* <anonymous> = 0]'
/usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc:55:3:   required from here
/usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/selector.hh:91:49: error: request for member 'code' in 'vts#0', which is of non-class type 'cmp_result'
   91 |     : m_imprint {unshift (compute_imprint ((vts.code ())...), sizeof... (Ts))}
      |                                             ~~~~^~~~
/usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/selector.hh:92:43: error: request for member 'code' in 'vts#0', which is of non-class type 'cmp_result'
   92 |     , m_mask {unshift (compute_mask ((vts.code ())...), sizeof... (Ts))}
      |                                       ~~~~^~~~
/usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/selector.hh:92:72: error: cannot convert '<brace-enclosed initializer list>' to 'selector::sel_t' {aka 'unsigned int'} in initialization
   92 |     , m_mask {unshift (compute_mask ((vts.code ())...), sizeof... (Ts))}
      |                                                                        ^
/usr/src/RPM/BUILD/dwgrep-0.4/libzwerg/selector.hh:92:72: error: cannot convert '<brace-enclosed initializer list>' to 'selector::sel_t' {aka 'unsigned int'} in initialization
gmake[2]: *** [libzwerg/CMakeFiles/test-value-cst.dir/build.make:82: libzwerg/CMakeFiles/test-value-cst.dir/test-value-cst.cc.o] Error 1
gmake[2]: Leaving directory '/usr/src/RPM/BUILD/dwgrep-0.4/x86_64-alt-linux'
gmake[1]: *** [CMakeFiles/Makefile2:541: libzwerg/CMakeFiles/test-value-cst.dir/all] Error 2
gmake[1]: Leaving directory '/usr/src/RPM/BUILD/dwgrep-0.4/x86_64-alt-linux'
gmake: *** [Makefile:160: all] Error 2

Signedness of DW_AT_const_value can be deduced from enumerator DW_AT_const_value

The following file:

enum N{A};
template<N n>class gah{};
gah<A> meh;

When compiled with gcc (GCC) 4.9.2 20141101 (Red Hat 4.9.2-1), produces the following object file:

$ gzip -c gah.o | base64 
H4sICCt6uVQAA2dhaC5vAJVVwW7TQBCdtZ02iVPTKAJaNZVcIdREwU5cRVUppBRFUCpQVFEhuFWO
s8RRa6dynKqc+gkcuXJCHPkX/oIbZw6wa6+J43hlGCWembfzZt+u1/bNs1fPBYQgMgQHMMtmZguz
+JBdV2EFTkkkBXk+oElxktADCaEHJBKfRmMIBXHOhc2gZsnBNqAcLSqIMxlldF+pyKKyoazeJY0k
JOZleV9+JKMK6VYDMV9dIR0FJCozPNci+HGlKpO2bRJS/LjyZF1YIy2rVFCoNGV9APeC8c1A4i9l
hVyDbUH0NzRt3bKCMhY27bGDm5fY95q+c0nRx7VevTU9gKPeG7XbaKht/aG+o+60jLZhtAy19hoP
1BemH+KaUVc1x5+6uDPELvZGFklNz7I713u72m5b1YaqNvEHHavRMAyAo253X62R1vXMvgD65IPj
m33ifS/0dhT5+NoHfWD6Juj9yQR0D1+Y+gD3p8Ozkft+DCw2+30PX80Nm57pDvEkqrgYuTiKSXfQ
rbHjYJd0d8c+1olUot+0zlP3+v9tI7wVsJTADzn1yTO8xTAxgf8rfxvCc8PjJ+uTuZGCxflvM/j0
+ZBg0b4th/4ryxVWF53xNeY7nPk/MX+aMf8Jh/+DeTWD/xLS9b/Lz+uk+umSkvrPOPMXGbidMf85
w1oJ3GCFUw4/8lcc/hdWoGXwb1I0UfueBqbUlmHx7MX5HzP4NBdg0Wz2QO0xwi3yL8Hi/hc4839m
56+UMT/PaJ0EP3+njYmcLmLqSiieppDiaSeP4sm3SYQvc/ACBy9y8OSuRLi8gNH9Lsf0/105+97Q
ryS1SHER5t+FpRhOVW6xvJzAI7udwKMVr8fw+HdSS9TfYXkvpje+2rjOXAz/A+79dGZwCAAA

dwgrep gives the following citation:

$ ./dwgrep/dwgrep ~/tmp/gah.o -e 'entry ?TAG_template_value_parameter @AT_const_value'
DW_AT_const_value on a DIE whose DW_AT_type is a DW_TAG_enumeration_type without DW_AT_encoding or DW_AT_type.  Assuming signed.
0

However, DW_AT_type's (which is a DW_TAG_enumeration_type) children's (DW_TAG_enumerator) DW_AT_const_value's form could be inspected. In this particular case, it's DW_FORM_sdata, implying that the quantity is signed. (Note that that itself seems to be a bug, but that's not something that we can address in dwgrep.)

Besides, for values without the high bit set, the warning can be muffled, because signedness wouldn't change the value anyway. That's second part of this bugfix.

Allow naming variables like builtins

It should be possible to introduce a variable of the same name as builtin. This is important for forward compatibility, because introducing a new built-in word later on would make programs that use that name for a variable invalid.

unhandled: DW_AT_const_value on a DIE whose DW_AT_type is a DW_TAG_enumeration_type with DW_AT_type

$ ./dwgrep/dwgrep ../tests/const_value_on_enum_with_type.o -e 'entry (offset == 0x3f) @AT_const_value'
dwgrep: /home/petr/proj/dwgrep-older/libzwerg/atval.cc:468: std::unique_ptr<value_producer<value> > {anonymous}::handle_at_dependent_value(Dwarf_Attribute, const value_die&, std::shared_ptr<dwfl_context>): Assertion `! "unhandled: DW_AT_const_value on a DIE whose" " DW_AT_type is a DW_TAG_enumeration_type with" " DW_AT_type"' failed.
Aborted (core dumped)

Introduce vocabulary versioning

To support backward compatibility of word behavior, it is desirable that vocabularies organize their words according to version numbers, and can on request provide a view of words according to a given version number. Thus an "entry@v1" and "entry@v2" of Dwarf vocabulary could behave subtly differently.

It should be possible to request a particular version though the C API and though dwgrep CLI interface. It might also make sense to make it selectable from the program itself.

Duplicate DW_AT_abstract_origin not pruned when "attribute" integrates

$ ./dwgrep/dwgrep ./libzwerg/libzwerg.so.0.1 -e '
    entry (name == "overload_op") ?DW_TAG_GNU_call_site attribute'
low_pc (addr)   0x60ed7;
abstract_origin (ref4)  [3680b6];
sibling (ref4)  [36f1e5];
abstract_origin (ref4)  [368084];
linkage_name (strp) _ZN11overload_opC2ESt10shared_ptrI2opE17overload_instance;
high_pc (data8) 33;
frame_base (exprloc)    0..0xffffffffffffffff:[0:call_frame_cfa];
object_pointer (ref4)   [3680da];
GNU_all_call_sites (flag_present)   true;
specification (ref4)    [34c2b1];
inline (data1)  DW_INL_not_inlined;
external (flag_present) true;
name (strp) overload_op;
decl_file (data1)   /home/petr/proj/dwgrep-older/libzwerg/overload.cc;
decl_line (data1)   205;
accessibility (data1)   DW_ACCESS_public;

Memory leak in bound closure

$ valgrind --leak-check=full ./dwgrep/dwgrep -e '{}->F;'
==12447== Memcheck, a memory error detector
==12447== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==12447== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==12447== Command: ./dwgrep/dwgrep -e {}-\>F;
==12447== 
==12447== 
==12447== HEAP SUMMARY:
==12447==     in use at exit: 192 bytes in 4 blocks
==12447==   total heap usage: 16,953 allocs, 16,949 frees, 892,315 bytes allocated
==12447== 
==12447== 192 (56 direct, 136 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4
==12447==    at 0x4C2A0D7: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==12447==    by 0x4E92BA7: allocate (new_allocator.h:104)
==12447==    by 0x4E92BA7: allocate (alloc_traits.h:357)
==12447==    by 0x4E92BA7: __shared_count<frame, std::allocator<frame>, std::shared_ptr<frame>, long unsigned int&> (shared_ptr_base.h:616)
==12447==    by 0x4E92BA7: __shared_ptr<std::allocator<frame>, std::shared_ptr<frame>, long unsigned int&> (shared_ptr_base.h:1090)
==12447==    by 0x4E92BA7: shared_ptr<std::allocator<frame>, std::shared_ptr<frame>, long unsigned int&> (shared_ptr.h:316)
==12447==    by 0x4E92BA7: allocate_shared<frame, std::allocator<frame>, std::shared_ptr<frame>, long unsigned int&> (shared_ptr.h:588)
==12447==    by 0x4E92BA7: make_shared<frame, std::shared_ptr<frame>, long unsigned int&> (shared_ptr.h:604)
==12447==    by 0x4E92BA7: op_scope::pimpl::next() (op.cc:752)
==12447==    by 0x4E8D15C: op_scope::next() (op.cc:792)
==12447==    by 0x4EBBFA5: operator() (libzwerg.cc:291)
==12447==    by 0x4EBBFA5: capture_errors<zw_result_next(zw_result*, zw_stack**, zw_error**)::<lambda()> > (libzwerg.cc:85)
==12447==    by 0x4EBBFA5: zw_result_next (libzwerg.cc:309)
==12447==    by 0x40483B: main (dwgrep.cc:290)
==12447== 
==12447== LEAK SUMMARY:
==12447==    definitely lost: 56 bytes in 1 blocks
==12447==    indirectly lost: 136 bytes in 3 blocks
==12447==      possibly lost: 0 bytes in 0 blocks
==12447==    still reachable: 0 bytes in 0 blocks
==12447==         suppressed: 0 bytes in 0 blocks
==12447== 
==12447== For counts of detected and suppressed errors, rerun with: -v
==12447== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

@AT_decl_file asserts on systemtap debuginfo

A strange bug in reading DW_AT_decl_file:

$ rpm -q systemtap-debuginfo
systemtap-debuginfo-2.6-3.fc21.x86_64
$ ./dwgrep/dwgrep -e 'entry (offset == 0x1306a) @AT_decl_file' /usr/lib/debug/usr/bin/stap.debug
dwgrep: /home/petr/proj/dwgrep-older/libzwerg/dwpp.hh:52: void throw_libdw(int): Assertion `dwerr != 0' failed.
Aborted (core dumped)
$ ./dwgrep/dwgrep -e 'entry (offset == 0x1306a) attribute ?AT_decl_file value' /usr/lib/debug/usr/bin/stap.debug
/usr/src/debug/systemtap-2.6/cscommon.h
/usr/src/debug/systemtap-2.6/cscommon.h

Build fails when building in ./build directory: "/bin/ld: cannot open linker script file libzwerg.map: No such file or directory"

Trying to build dwgrep from Git master using a common procedure used with CMake projects:

$ # In dwgrep Git checkout directory
$ mkdir build && cd build
$ cmake ..
$ make

I get the following error:

Scanning dependencies of target libzwerg
[ 87%] Linking CXX shared library libzwerg.so
/bin/ld: cannot open linker script file libzwerg.map: No such file or directory
collect2: error: ld returned 1 exit status

I've read the comment in libzwerg/CMakeLists.txt:99 about the problem of specifying a dependency between the DSO and its map file. I was wondering if any of the links below could be of help with fixing this problem.

[CMake] How to use a generated linker map with a shared library?
Re: [CMake] How to use a generated linker map with a shared library?
[CMake] adding dependencies on generated files to source code files

0.4: build fails with gcc 11.2.1

gcc 11.2.1 from fedora rawhide

[ 70%] Building CXX object libzwerg/CMakeFiles/test-value-cst.dir/test-value-cst.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++ -DGTEST_LINKED_AS_SHARED_LIBRARY=1 -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -DNDEBUG -MD -MT libzwerg/CMakeFiles/test-value-cst.dir/test-value-cst.cc.o -MF CMakeFiles/test-value-cst.dir/test-value-cst.cc.o.d -o CMakeFiles/test-value-cst.dir/test-value-cst.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:38,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:37,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value-cst.hh:34,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/selector.hh:45:57: warning: ‘this’ pointer is null [-Wnonnull]
   45 |   static_assert (sizeof (((value_type *) nullptr)->code ()) == 1,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value-cst.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value.hh:88:11: note: in a call to non-static member function ‘uint8_t value_type::code() const’
   88 |   uint8_t code () const { return m_code; }
      |           ^~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:38,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:37,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value-cst.hh:34,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/selector.hh: In instantiation of ‘selector::selector(Ts ...) [with Ts = {cmp_result}; typename std::enable_if<(sizeof... (Ts) <= selector::W), int>::type Fake = 0]’:
/usr/include/gtest/gtest-printers.h:215:9:   required from ‘static void testing::internal::internal_stream_operator_without_lexical_name_lookup::StreamPrinter::PrintValue(const T&, std::ostream*) [with T = cmp_result; <template-parameter-1-2> = void; <template-parameter-1-3> = std::basic_ostream<char>&; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:312:22:   required from ‘void testing::internal::PrintWithFallback(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:441:30:   required from ‘void testing::internal::PrintTo(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:691:12:   required from ‘static void testing::internal::UniversalPrinter<T>::Print(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:980:30:   required from ‘void testing::internal::UniversalPrint(const T&, std::ostream*) [with T = cmp_result; std::ostream = std::basic_ostream<char>]’
/usr/include/gtest/gtest-printers.h:865:19:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/gtest/gtest-printers.h:334:36:   required from ‘static std::string testing::internal::FormatForComparison<ToPrint, OtherOperand>::Format(const ToPrint&) [with ToPrint = cmp_result; OtherOperand = cmp_result; std::string = std::__cxx11::basic_string<char>]’
/usr/include/gtest/gtest-printers.h:415:45:   required from ‘std::string testing::internal::FormatForComparisonFailureMessage(const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result; std::string = std::__cxx11::basic_string<char>]’
/usr/include/gtest/gtest.h:1527:53:   required from ‘testing::AssertionResult testing::internal::CmpHelperEQFailure(const char*, const char*, const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result]’
/usr/include/gtest/gtest.h:1549:28:   required from ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result]’
/usr/include/gtest/gtest.h:1564:23:   required from ‘static testing::AssertionResult testing::internal::EqHelper::Compare(const char*, const char*, const T1&, const T2&) [with T1 = cmp_result; T2 = cmp_result; typename std::enable_if<((! std::is_integral<_Tp>::value) || (! std::is_pointer<_Dp>::value))>::type* <anonymous> = 0]’
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-value-cst.cc:55:3:   required from here
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/selector.hh:91:49: error: request for member ‘code’ in ‘vts#0’, which is of non-class type ‘cmp_result’
   91 |     : m_imprint {unshift (compute_imprint ((vts.code ())...), sizeof... (Ts))}
      |                                             ~~~~^~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/selector.hh:92:43: error: request for member ‘code’ in ‘vts#0’, which is of non-class type ‘cmp_result’
   92 |     , m_mask {unshift (compute_mask ((vts.code ())...), sizeof... (Ts))}
      |                                       ~~~~^~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/selector.hh:91:7: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘selector::sel_t’ {aka ‘unsigned int’} in initialization
   91 |     : m_imprint {unshift (compute_imprint ((vts.code ())...), sizeof... (Ts))}
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/selector.hh:92:7: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘selector::sel_t’ {aka ‘unsigned int’} in initialization
   92 |     , m_mask {unshift (compute_mask ((vts.code ())...), sizeof... (Ts))}
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [libzwerg/CMakeFiles/test-value-cst.dir/build.make:79: libzwerg/CMakeFiles/test-value-cst.dir/test-value-cst.cc.o] E

Implement `next` and `prev` for `T_DIE`.

next :: T_DIE ->? T_DIE
  Like dwarf_siblingof, returns next sibling of the DIE.

prev :: T_DIE ->? T_DIE
  The opposite of next.

prev may need a supporting cache similar to parent.

Support Dwarf 5 attributes

There are many new attributes in Dwarf 5. Near-term, dwgrep shouldn't just crash every time it encounters an unknown integral constant (currently it asserts with "signedness unhandled"). Long-term, these should be properly supported.
There are also some new constant domains that will need to be added.
There's also a new section name .debug_names.
And some new tags, but I think we may not care.
Grepping for "New in DWARF Version 5" in the standard yields the new stuff.

Support for DW_DEFAULTED_* and DW_AT_defaulted has been added to master, but that's just the tip of an iceberg.

Is it possible to use dwgrep to list source files

Is it possible to use dwgrep to list source files, similar to what debugedit extracts from binaries. (I.e. .debug_line section entries with directory tables combined with file name tables.)

Can you please provide usage example for this if it's possible?

Double minus in front of overflown enumerator

Source:

enum N{A=9223372036854775808UL};
template<N n>class gah{};
gah<A> meh;

Object (compiler can be gleaned from DW_AT_producer):

$ gzip -c gah3.o | base64 
H4sICBIHu1QAA2dhaDMubwCVVU1v00AQHdtJmjSNaRQBrZpKRgg1VYgb56tpIaUoglIVVYiKc3Gc
JQmtncpxqnIKN3rjb8C/4MyJv8KJA0iwa6+Js/HKMEo8M2/n7bxdr+3Jk+dPRUEA3wTYg2k2tWtx
Gu/T6zJkAOEo5uZJlxYLksRjjAp1HEmP4b1vE69IEMQT7OIWrGMXGE2YqA+CRGgpaSosK9yTc2lJ
XpOXb+OpY4KUTKd30w/SQg7PXwApmc/g/qIgyVM8Xsb4YY6MJGo4JPhh7tGquIKnzBOJnvaQFQPc
dcfXXa0/5Qy+uhslkF9P76uG4ZbRcKs/NNHWBXLsLce8gIPjV0q7WFRq6o5aUSplraZpZU0pvERd
5ZnueHhJ21RKpjO2UKuHLGQPDJzqttFvXTUbpUZNKfWU0sjptoxiUdNIp4eF482dSqVa3a6Uq41m
vba9XW+Wm+M9gIN2e1cp4L6bkU0B1NE709E72Du25/t+5KArB9Su7uigdkYjUG10rqtd1Bn3TgfW
myHQWO90bHQ5M6zbutVDI7/ifGAhP8azg2oMTRNZeHZr6CAVS8WL042z0N3/P1vzbgwkGHyfU8+e
8TsUkxj8X/kb4J0iHp+tZ3MtBAvyBxH8+8A8e9S+LXj+E81lWuef+BXqW5z+n6k/iej/gsP/Rb0S
wT+CcP1XyVmdRD9ZEqv/lNM/T8GNiP5nFCszeJsWfuDwfX/J4X+lBaUI/iREE7EfYWBIbRbmz16Q
/zGCT3IR5u2aPlBNSriB/0swv/8pTv8v9PwtRfTnGamLwfffYWMSZxYpdCUED1NI8LCTR3D2beLj
Cxw8xcEXOTi7Kz6ensPIfmcD+v+unH59yDeTmK94EWbfhUsBnKi8RfMsg/t2k8H9Fa8G8OBXs8HU
v6X564De4GqDOuMB/A8QcgbXkAgAAA==

Output:

$ ./dwgrep/dwgrep ~/tmp/gah3.o -e 'entry ?TAG_template_value_parameter'
[41]    template_value_parameter
    name (string)   n;
    type (ref4) [1d];
    const_value (sdata) --9223372036854775808;

DW_AT_const_value on an enumeration_type with DW_AT_type

Code:

enum N{A};
template<N n>class gah{};
gah<A> meh;

Build with GCC trunk (a6f19a7c6b). The built object:

$ cat a.out | gzip -c | base64
H4sIANXYulQAA5VVzW7TQBCetd381GloFCFakYORQCSUOk5pK1QgLYr4iagihFSBemjlJEscNXYi
26nKqY/AGyCOcONdeBLOIMGuvSbOxovLSPHsfPvNzLejjX357PC5hBBEhqAJs2hmljRbH7DnKqzA
MVkpQZwL0pSIJHVAuU8LIvqUn9I9JUt3loI+SHpJXMaB9YCetbEFSH5Alnl5pqaE7hTLqlxcvUEq
KkjOqWq7vKc+UlGZFK2CnKuopPBtUNUmoZHiEpKLqhpRMgahtMuUlN0mS4q3y/vr0hqpXqEyQ+0J
JwbYCvbDQ/wsrpBnMCjyQ3VrbOP6BPtu3bcnAAPT0nu9YHIvOkdaa2ND29EN3dC2jMaO0WjsalV8
McHu0MaOb45q2uYA5mvUWYmp4w0HDu5rQ8enZR9XOzVj2iR1W609rUqq1/5dGkD3Pti+2SXed0Nv
RSsfX/ig903fBL3reaC7eGTqfdydDk6HzvsxsLXZ7br4fG7bdE1ngL2IMRo6OFqT6qD3xjZVALoz
9rFOdG56vtk7S5zs/9vNcPCQ4fADAZ+/w7cYJnP4VfPvQnhLRPk8n48bCVg8/yQln95CBRbtWzb0
X1hcZLzoRq8x/0TQ/9MV+78W5P9iXkvJfwXJ+t/l5nVS/fRIvP5TQf8KA3dT+p8xzODwN4z4VpAf
+XNB/ldGuJeSf5mgidr3JDCBW4LFuxfP/5iST2MJFs1if6iHLOEa+RVgcf55Qf/P7P4VUvqLjPIU
+PE7aU8WVJETT0LxJIUUT7p5FOffJhGeFeB5Ab4swPmpRLi6gNF5l2L6/56cfRbo55FapHgZ5t+F
hRgeV1ni8BqLr8fw+NevzvH3WbzN4YcsPorpjZ82rnMphv8B/8TKUHAIAAA=

Reproducer:

$ ./dwgrep/dwgrep ~/src/gcc/build/a.out -e 'entry ?TAG_template_value_parameter @AT_const_value'
dwgrep: /home/petr/proj/dwgrep-older/libzwerg/atval.cc:473: std::unique_ptr<value_producer<value> > {anonymous}::handle_at_dependent_value(Dwarf_Attribute, Dwarf_Die, std::shared_ptr<dwfl_context>): Assertion `! "unhandled: DW_AT_const_value on a DIE whose" " DW_AT_type is a DW_TAG_enumeration_type with" " DW_AT_type"' failed.
Aborted (core dumped)

frame cloning too expensive

$ time dwgrep/dwgrep -c -e '
    let A := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
    let B := [A elem 10 mul A elem add];
    let C := [B elem 100 mul B elem add];
    C elem'
10000

real    0m4.888s
user    0m3.907s
sys 0m0.986s

The problem lies (I think) in the fact that elem clones the context for each new result. Cloning context involves cloning the topmost stack frame, which contains A, B, and C, containing lots of values, which are all recursively cloned. Of course that needs to be done, because the two cloned frames might end up binding different values to individual slots, so at least the empty slots need to be per-frame. Perhaps something clever with partial sharing of frames can be invented.

There's a lot of this thing going on. All the values are immutable (except for set_pos), and cloning them shouldn't be strictly necessary. However, simply converting unique pointers to shared ones makes the matters worse (see branch pmachata/shared_ptr), possibly because work with atomic counters is worse than actually cloning the values.

There should be a `peel` word

It is awkward, error prone, and not future-proof to have to write ((?DW_TAG_const_type || ?DW_TAG_volatile_type || ...) @DW_AT_type)*. A new peelable DW_TAG_atomic_type will be added to Dwarf 5, so clearly future-proofing is necessary.

Values such as DW_AT_lo_user should be available

Unknown attribute names are reported as e.g. DW_AT_lo_user+0x136, but it's impossible to reconstruct the value in dwgrep itself (one needs to look up what the value is in dwarf.h). Having the lo_user and hi_user values available would allow the user to say DW_AT_lo_user value 0x136 add. Bonus points if lo_user have a domain that allows arithmetic without warning, thus obviating the need for "value" in the listed expression.

0.4 + master patches: build fails

[tkloczko@barrel x86_64-redhat-linux-gnu]$ cmake -L
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


CMake Error: The source directory "/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
-- Cache values
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_INSTALL_PREFIX:PATH=/usr
[tkloczko@barrel x86_64-redhat-linux-gnu]$ make -k
/usr/bin/cmake -S/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 -B/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/CMakeFiles /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/LibzwergDw.dir/build.make libzwerg/CMakeFiles/LibzwergDw.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/CMakeFiles/LibzwergDw.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/LibzwergDw.dir/build.make libzwerg/CMakeFiles/LibzwergDw.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[2]: Nothing to be done for 'libzwerg/CMakeFiles/LibzwergDw.dir/build'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 23%] Built target LibzwergDw
make  -f libzwerg/CMakeFiles/LibzwergCore.dir/build.make libzwerg/CMakeFiles/LibzwergCore.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/CMakeFiles/LibzwergCore.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/LibzwergCore.dir/build.make libzwerg/CMakeFiles/LibzwergCore.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 24%] Building CXX object libzwerg/CMakeFiles/LibzwergCore.dir/parser.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++  -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -O2 -g -DNDEBUG -fPIC -o CMakeFiles/LibzwergCore.dir/parser.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/parser.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/tree.hh:38,
                 from parser.yy:37,
                 from parser.yy:31:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh: In member function ‘void stack::need(unsigned int) const’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:82:18: error: ‘runtime_error’ is not a member of ‘std’
   82 |       throw std::runtime_error ("stack overflow");
      |                  ^~~~~~~~~~~~~
make[2]: *** [libzwerg/CMakeFiles/LibzwergCore.dir/build.make:106: libzwerg/CMakeFiles/LibzwergCore.dir/parser.cc.o] Error 1
[ 25%] Building CXX object libzwerg/CMakeFiles/LibzwergCore.dir/builtin-shf.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++  -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -O2 -g -DNDEBUG -fPIC -o CMakeFiles/LibzwergCore.dir/builtin-shf.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:36,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh: In member function ‘void stack::need(unsigned int) const’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:82:18: error: ‘runtime_error’ is not a member of ‘std’
   82 |       throw std::runtime_error ("stack overflow");
      |                  ^~~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:37,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/pred_result.hh: In function ‘pred_result operator!(pred_result)’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/pred_result.hh:51:3: error: ‘abort’ was not declared in this scope
   51 |   abort ();
      |   ^~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh: At global scope:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:160:44: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  160 |   std::string name () const override final { return "stub"; }
      |                                            ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:166:44: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  166 |   std::string name () const override final { return "stub"; }
      |                                            ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:240:15: error: field ‘m_str’ has incomplete type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
  240 |   std::string m_str;
      |               ^~~~~
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/memory:74,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:30:
/usr/include/c++/10/bits/stringfwd.h:74:11: note: declaration of ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’}
   74 |     class basic_string;
      |           ^~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:243:66: error: ‘str’ has incomplete type
  243 |   stringer_lit (std::shared_ptr <stringer> upstream, std::string str)
      |                                                      ~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/memory:74,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:30:
/usr/include/c++/10/bits/stringfwd.h:74:11: note: declaration of ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’}
   74 |     class basic_string;
      |           ^~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:601:35: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  601 |   static std::string docstring () { return "internal"; }
      |                                   ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:74:18: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
   74 | op_drop::name () const
      |                  ^~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:80:21: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
   80 | op_drop::docstring ()
      |                     ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:101:18: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  101 | op_swap::name () const
      |                  ^~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:107:21: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  107 | op_swap::docstring ()
      |                     ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:125:17: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  125 | op_dup::name () const
      |                 ^~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:131:20: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  131 | op_dup::docstring ()
      |                    ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:149:18: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  149 | op_over::name () const
      |                  ^~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:155:21: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  155 | op_over::docstring ()
      |                     ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:178:17: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  178 | op_rot::name () const
      |                 ^~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-shf.cc:184:20: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  184 | op_rot::docstring ()
      |                    ^
make[2]: *** [libzwerg/CMakeFiles/LibzwergCore.dir/build.make:198: libzwerg/CMakeFiles/LibzwergCore.dir/builtin-shf.cc.o] Error 1
[ 26%] Building CXX object libzwerg/CMakeFiles/LibzwergCore.dir/builtin.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++  -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -O2 -g -DNDEBUG -fPIC -o CMakeFiles/LibzwergCore.dir/builtin.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:36,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin-cst.hh:36,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/builtin.cc:35:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh: In member function ‘void stack::need(unsigned int) const’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:82:18: error: ‘runtime_error’ is not a member of ‘std’
   82 |       throw std::runtime_error ("stack overflow");
      |                  ^~~~~~~~~~~~~
make[2]: *** [libzwerg/CMakeFiles/LibzwergCore.dir/build.make:211: libzwerg/CMakeFiles/LibzwergCore.dir/builtin.cc.o] Error 1
[ 28%] Building CXX object libzwerg/CMakeFiles/LibzwergCore.dir/scon.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++  -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -O2 -g -DNDEBUG -fPIC -o CMakeFiles/LibzwergCore.dir/scon.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:36,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh: In member function ‘void stack::need(unsigned int) const’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:82:18: error: ‘runtime_error’ is not a member of ‘std’
   82 |       throw std::runtime_error ("stack overflow");
      |                  ^~~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:37,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/pred_result.hh: In function ‘pred_result operator!(pred_result)’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/pred_result.hh:51:3: error: ‘abort’ was not declared in this scope
   51 |   abort ();
      |   ^~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh: At global scope:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:160:44: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  160 |   std::string name () const override final { return "stub"; }
      |                                            ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:166:44: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  166 |   std::string name () const override final { return "stub"; }
      |                                            ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:240:15: error: field ‘m_str’ has incomplete type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
  240 |   std::string m_str;
      |               ^~~~~
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/memory:74,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.hh:34,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc:29:
/usr/include/c++/10/bits/stringfwd.h:74:11: note: declaration of ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’}
   74 |     class basic_string;
      |           ^~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:243:66: error: ‘str’ has incomplete type
  243 |   stringer_lit (std::shared_ptr <stringer> upstream, std::string str)
      |                                                      ~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/memory:74,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.hh:34,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc:29:
/usr/include/c++/10/bits/stringfwd.h:74:11: note: declaration of ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’}
   74 |     class basic_string;
      |           ^~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/scon.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:601:35: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  601 |   static std::string docstring () { return "internal"; }
      |                                   ^
make[2]: *** [libzwerg/CMakeFiles/LibzwergCore.dir/build.make:328: libzwerg/CMakeFiles/LibzwergCore.dir/scon.cc.o] Error 1
[ 29%] Building CXX object libzwerg/CMakeFiles/LibzwergCore.dir/stack.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++  -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -O2 -g -DNDEBUG -fPIC -o CMakeFiles/LibzwergCore.dir/stack.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh: In member function ‘void stack::need(unsigned int) const’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:82:18: error: ‘runtime_error’ is not a member of ‘std’
   82 |       throw std::runtime_error ("stack overflow");
      |                  ^~~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:37,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value-closure.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:31:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/pred_result.hh: In function ‘pred_result operator!(pred_result)’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/pred_result.hh:51:3: error: ‘abort’ was not declared in this scope
   51 |   abort ();
      |   ^~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value-closure.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:31:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh: At global scope:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:160:44: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  160 |   std::string name () const override final { return "stub"; }
      |                                            ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:166:44: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  166 |   std::string name () const override final { return "stub"; }
      |                                            ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:240:15: error: field ‘m_str’ has incomplete type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}
  240 |   std::string m_str;
      |               ^~~~~
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/memory:74,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:30:
/usr/include/c++/10/bits/stringfwd.h:74:11: note: declaration of ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’}
   74 |     class basic_string;
      |           ^~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value-closure.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:31:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:243:66: error: ‘str’ has incomplete type
  243 |   stringer_lit (std::shared_ptr <stringer> upstream, std::string str)
      |                                                      ~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/iosfwd:39,
                 from /usr/include/c++/10/memory:74,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:30:
/usr/include/c++/10/bits/stringfwd.h:74:11: note: declaration of ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’}
   74 |     class basic_string;
      |           ^~~~~~~~~~~~
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/value-closure.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:31:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/op.hh:601:35: error: return type ‘std::string’ {aka ‘class std::__cxx11::basic_string<char>’} is incomplete
  601 |   static std::string docstring () { return "internal"; }
      |                                   ^
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc: In function ‘int {anonymous}::compare_stack(const std::vector<std::unique_ptr<zw_value> >&, const std::vector<std::unique_ptr<zw_value> >&)’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.cc:88:8: error: ‘abort’ was not declared in this scope
   88 |        abort ();
      |        ^~~~~
make[2]: *** [libzwerg/CMakeFiles/LibzwergCore.dir/build.make:354: libzwerg/CMakeFiles/LibzwergCore.dir/stack.cc.o] Error 1
[ 30%] Building CXX object libzwerg/CMakeFiles/LibzwergCore.dir/tree_cr.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++  -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -O2 -g -DNDEBUG -fPIC -o CMakeFiles/LibzwergCore.dir/tree_cr.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/tree_cr.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/tree.hh:38,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/tree_cr.hh:33,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/tree_cr.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh: In member function ‘void stack::need(unsigned int) const’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:82:18: error: ‘runtime_error’ is not a member of ‘std’
   82 |       throw std::runtime_error ("stack overflow");
      |                  ^~~~~~~~~~~~~
make[2]: *** [libzwerg/CMakeFiles/LibzwergCore.dir/build.make:393: libzwerg/CMakeFiles/LibzwergCore.dir/tree_cr.cc.o] Error 1
make[2]: Target 'libzwerg/CMakeFiles/LibzwergCore.dir/build' not remade because of errors.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[1]: *** [CMakeFiles/Makefile2:433: libzwerg/CMakeFiles/LibzwergCore.dir/all] Error 2
make  -f libzwerg/CMakeFiles/LibZwergVersionScript.dir/build.make libzwerg/CMakeFiles/LibZwergVersionScript.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/CMakeFiles/LibZwergVersionScript.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/LibZwergVersionScript.dir/build.make libzwerg/CMakeFiles/LibZwergVersionScript.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && sh /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/build-version-script.sh /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 30%] Built target LibZwergVersionScript
make  -f libzwerg/CMakeFiles/TestStub.dir/build.make libzwerg/CMakeFiles/TestStub.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/CMakeFiles/TestStub.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/TestStub.dir/build.make libzwerg/CMakeFiles/TestStub.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[2]: Nothing to be done for 'libzwerg/CMakeFiles/TestStub.dir/build'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 32%] Built target TestStub
make  -f libzwerg/CMakeFiles/TestZwAux.dir/build.make libzwerg/CMakeFiles/TestZwAux.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/CMakeFiles/TestZwAux.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/TestZwAux.dir/build.make libzwerg/CMakeFiles/TestZwAux.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 33%] Building CXX object libzwerg/CMakeFiles/TestZwAux.dir/test-zw-aux.cc.o
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg && /usr/bin/g++  -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -std=c++11 -Wall -Wnon-virtual-dtor -O2 -g -O2 -g -DNDEBUG -o CMakeFiles/TestZwAux.dir/test-zw-aux.cc.o -c /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-zw-aux.cc
In file included from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-zw-aux.hh:35,
                 from /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-zw-aux.cc:30:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh: In member function ‘void stack::need(unsigned int) const’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/stack.hh:82:18: error: ‘runtime_error’ is not a member of ‘std’
   82 |       throw std::runtime_error ("stack overflow");
      |                  ^~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-zw-aux.cc: In function ‘std::string get_parse_error(vocabulary&, std::string)’:
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-zw-aux.cc:73:15: error: ‘runtime_error’ in namespace ‘std’ does not name a type
   73 |   catch (std::runtime_error &err)
      |               ^~~~~~~~~~~~~
/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg/test-zw-aux.cc:75:14: error: ‘err’ was not declared in this scope; did you mean ‘errno’?
   75 |       return err.what ();
      |              ^~~
      |              errno
make[2]: *** [libzwerg/CMakeFiles/TestZwAux.dir/build.make:92: libzwerg/CMakeFiles/TestZwAux.dir/test-zw-aux.cc.o] Error 1
make[2]: Target 'libzwerg/CMakeFiles/TestZwAux.dir/build' not remade because of errors.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[1]: *** [CMakeFiles/Makefile2:682: libzwerg/CMakeFiles/TestZwAux.dir/all] Error 2
make  -f libzwerg/CMakeFiles/test-int.dir/build.make libzwerg/CMakeFiles/test-int.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/CMakeFiles/test-int.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/test-int.dir/build.make libzwerg/CMakeFiles/test-int.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[2]: Nothing to be done for 'libzwerg/CMakeFiles/test-int.dir/build'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 37%] Built target test-int
make  -f libzwerg/CMakeFiles/test-coverage.dir/build.make libzwerg/CMakeFiles/test-coverage.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/libzwerg/CMakeFiles/test-coverage.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f libzwerg/CMakeFiles/test-coverage.dir/build.make libzwerg/CMakeFiles/test-coverage.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[2]: Nothing to be done for 'libzwerg/CMakeFiles/test-coverage.dir/build'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 41%] Built target test-coverage
make  -f dwgrep/CMakeFiles/AuxLib.dir/build.make dwgrep/CMakeFiles/AuxLib.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/dwgrep /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/dwgrep /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/dwgrep/CMakeFiles/AuxLib.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f dwgrep/CMakeFiles/AuxLib.dir/build.make dwgrep/CMakeFiles/AuxLib.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[2]: Nothing to be done for 'dwgrep/CMakeFiles/AuxLib.dir/build'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 43%] Built target AuxLib
make  -f dwgrep/CMakeFiles/dwgrep-genman.dir/build.make dwgrep/CMakeFiles/dwgrep-genman.dir/depend
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
cd /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4 /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/dwgrep /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/dwgrep /home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu/dwgrep/CMakeFiles/dwgrep-genman.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make  -f dwgrep/CMakeFiles/dwgrep-genman.dir/build.make dwgrep/CMakeFiles/dwgrep-genman.dir/build
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make[2]: Nothing to be done for 'dwgrep/CMakeFiles/dwgrep-genman.dir/build'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
[ 46%] Built target dwgrep-genman
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/dwgrep-0.4/x86_64-redhat-linux-gnu'
make: *** [Makefile:163: all] Error 2
make: Target 'default_target' not remade because of errors.

Support passing arguments to scripts from command line

The immediate idea is to use $1, $2, etc. to refer to first, second, etc. command line argument.

Another possibility, maybe more in line with how dwgrep generally operates, is to have a word like argv that yields individual command line arguments. One could say things like argv (pos == 0) to get a particular one. That's less handy and I'm not sure passing arbitrary command line lists is useful. In the end, both can be present.

  • These would have to be passed in not only from command line, but also from the C and C++ wrappers. While C and C++ wrappers could pass in arbitrary value subclasses, only strings would come from the command line.
  • Systemtap has @1, @2, etc. for literals. $1, $2, etc. are pasted verbatim (macro-expanded so to speak) and lexed and parsed. This would allow the "17" be passed in as 17, "DW_AT_name" as DW_AT_name, etc. But we use @ for attribute access, and we might want to use @1 for access to location expression values (where currently you have to awkwardly type value (pos == 0)), macro arguments or possibly other things like that. Maybe we just need a word eval.
  • These could act like variables defined in outermost scope, which would simplify referencing them. Type inference (when/if it's done) would have to be done after these arguments are provided.
  • Command line interface would have to be changed so that it's clear where the arguments come from. We could use --args like GDB does. We shouldn't break the use case where one just dumps a bunch of files to dwgrep through to command line, such as dwgrep 'my query' $(find my files). That shouldn't translate to a bunch of script command line arguments.

"symbol" word crashes on separate-debuginfo file

$ ./dwgrep/dwgrep /usr/lib/debug/lib64/libcrypt-2.26.so.debug -e symbol
dwgrep: /usr/lib/debug/lib64/libcrypt-2.26.so.debug: No symbol table found

It shouldn't crash, it should just yield nothing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.