Fix pretty printers in _GLIBCXX_DEBUG mode

François Dumont frs.dumont@gmail.com
Tue Sep 25 20:12:00 GMT 2018


Hi

     Pretty printers tests are failing when run in _GLIBCXX_DEBUG with

make RUNTESTFLAGS=prettyprinters.exp check-debug

     The attached patch is fixing most of those failures but the 
following ones for which I am looking for some help:

got: type = 
std::unique_ptr<std::__debug::vector<std::unique_ptr<std::__debug::vector<int>*>>>
FAIL: libstdc++-prettyprinters/80276.cc whatis p1

The regex to match is:

   // { dg-final { whatis-regexp-test p1 
"std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?vector<int>\*>>>" 
} }

I just don't understand why it doesn't match.

In the same file, the next regex:

   // { dg-final { whatis-regexp-test p2 
"std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?set<int>\*>>\[\]>" 
} }

is producing a regex call error in the (TCL?) script:

got: type = 
std::unique_ptr<std::__debug::vector<std::unique_ptr<std::__debug::set<int>*>>[]>
ERROR: couldn't compile regular expression pattern: brackets [] not balanced
     while executing
"regexp -- $gdb_expected($test_counter) $first"
     invoked from within
"expect {
-i exp12 -timeout 600
         -re {^(type|\$([0-9]+)) = ([^\n\r]*)[\n\r]+} {
             send_log "got: $expect_out(buffer)"

             incr test_counter
             ..."
     ("uplevel" body line 1)
     invoked from within
"uplevel $body" REGEXP REG_EBRACK {brackets [] not balanced} couldn't 
compile regular expression pattern: brackets [] not balanced
UNRESOLVED: libstdc++-prettyprinters/80276.cc

I guess it must have something to do with the [] but as I escaped both I 
don't understand what's wrong.

Last error:

got: $17 = std::__debug::vector of length 1, capacity 2 = {2}
FAIL: libstdc++-prettyprinters/simple11.cc print v

for regex:

// { dg-final { regexp-test v {std::(__debug::)?vector of length 1, 
capacity 2 = {2}} } }

Once again I don't see why it doesn't match. Something to do with the 
'{2}' ?

Any regex expert to help me on those last issues so that I can propose a 
finalized patch ?

Thanks,

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_printers.patch
Type: text/x-patch
Size: 20886 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180925/3c217885/attachment.bin>


More information about the Libstdc++ mailing list