Code Monkey home page Code Monkey logo

libcxx-pretty-printers's People

Contributors

amoshtaghi avatar edobez avatar koutheir avatar leszekswirski avatar llunak avatar macfly avatar tanderson-google avatar yasushi-saito avatar yatharth 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  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

libcxx-pretty-printers's Issues

weak_ptr loop crashes debugger w/ stack overflow

I just tracked down a problem that was causing my gdb to mysteriously abort when it hit a breakpoint early in my program's execution. After a bit of digging through logs & print debugging in the pretty-printers, I discovered that a library I'm using has an object which keeps a vector of std::weak_ptrs to handler objects... one of which is itself. This repo's pretty printer has no guard against this and attempts to resolve it immediately (not in a lazy manner), therefore it prints weak_ptr -> vector -> weak_ptr -> ad infinitum (well, at least until the stack explodes).

I'm going to hack mine so that it doesn't call dereference on weak_ptrs, but I'm sure there is a better solution.

Pretty printers don't work on libc++ 17.0.2

Out of the box, nothing works. If I type info pretty-printers, gdb lists the printers, but when trying to print variables, it doesn't find the right printer.

After some debugging, I found out that the type names are std::_LIBCPP_ABI_NAMESPACE::.... The type name lookup regex is '^std::__[a-zA-Z0-9]+::'. I replacing it with '^std::[a-zA-Z0-9_]+::', it now finds a types, and can at least print a string. However, when I tried to print a map, I got the following error message:

MapPrinter.to_string
std::map (count=1)Traceback (most recent call last):
  File "/home/parallels/workspace/libcxx-pretty-printers/src/libcxx/v1/printers.py", line 736, in __next__
    result = ('[%d] %s' % (self.count, str(item['__cc']['first'])),
                                           ~~~~^^^^^^^^
gdb.error: There is no member or method named __cc.

I haven't tried any other types yet, but it looks like there is some serious discrepancy with this libc++ version.

__parent_ not found in rbtree node?

I've noticed that I'm getting these errors in the gdb console:

Traceback (most recent call last):
File "/home/andrew/.gdb/libcxx-pretty-printers/src/libcxx/v1/printers.py", line 615, in next
item = self.rbiter.next()
File "/home/andrew/.gdb/libcxx-pretty-printers/src/libcxx/v1/printers.py", line 673, in next
parent_node = parent_node.dereference()['_parent']
gdb.error: There is no member or method named _parent.

(note my line numbers will differ from the head of tree)

issue with shared pointer

I have this error trying to pretty print a shared pointer:

Traceback (most recent call last):
  File "/home/coval/libcxx-pretty-printers/src/libcxx/v1/printers.py", line 169, in to_string
    usecount = refcounts['__shared_count'] + 1
gdb.error: There is no member named __shared_count.

I have commented the lines 168 to 174 but I think there is a better solution.
I would love to help but not sure how you find the names of the fields?

With libc++1-8 std::string is out of date in pretty printers.

When displaying or printing std::strings I now get this error (Note executable_name is a std::string)

 (gdb) print executable_name
 $2 = Python Exception <class 'gdb.error'> There is no member or method named __first_.:

in my .gdbinit file

# libc++ gdb pretty printers
python
import sys 
sys.path.insert(0, '/home/rake/src/Tools/libcxx-pretty-printers/src') 
from libcxx.v1.printers import register_libcxx_printers 
register_libcxx_printers (None) 
end

and building with these c/cppflags enabled

-D_LIBCPP_DEBUG=1 -g -O0

Disabling libcxx pretty printers I get

(gdb) print executable_name
$2 = {<std::__1::__basic_string_common<true>> = {<No data fields>}, static __short_mask = 1, static __long_mask = 1, 
  __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {__cap_ = 81, 
            __size_ = 73, __data_ = 0x60f800 "/home/rake/src/Pluralsight/PracticalCppFeatures/build/PractialCppFeatures"}, __s = {{__size_ = 81 'Q', __lx = 81 'Q'}, 
            __data_ = "\000\000\000\000\000\000\000I\000\000\000\000\000\000\000\000\370`\000\000\000\000"}, __r = {__words = {81, 73, 
              6354944}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<No data fields>}, <No data fields>}, <No data fields>}, static npos = 18446744073709551615}

And strangely enough in lldb I get

print executable_name
(std::__1::string) $1 = "/home/rake/src/Pluralsight/PracticalCppFeatures/build/PractialCppFeatures"

They both show the correct data but one is a garbled mess of information.

There is no member or method named __short_mask

My platform: Windows 10, Msys2, clang 15.0.5

test code:

int main(int argc, char *argv[])
{
    std::string koza{"koza"};
    spdlog::info("{}",koza); // break point here 
} 

GDB>> p koza

Python Exception <class 'gdb.error'>: There is no member or method named __short_mask.

my std::string content without libcxx-pretty-printers

$2 = {
  static __endian_factor = 2,
  __r_ = {
    <std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {
      __value_ = {
        {
          __l = {
            {
              __is_long_ = 0,
              __cap_ = 209332974980
            },
            __size_ = 0,
            __data_ = 0x51 <error: Cannot access memory at address 0x51>
          },
          __s = {
            {
              __is_long_ = 0 '\000',
              __size_ = 4 '\004'
            },
            __padding_ = 0x14fe79 "koza",
            __data_ = "koza", '\000' <repeats 11 times>, "Q\000\000\000\000\000\000"
          },
          __r = {
            __words = {418665949960, 0, 81}
          }
        }
      }
    }, 
    <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {
      <std::__1::allocator<char>> = {
        <std::__1::__non_trivial_if<true, std::__1::allocator<char> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>},
  static npos = 18446744073709551615

No pretty printers working on Linux

I'm trying to get this project working on an AAarch64 Ubuntu 18.04 system while remote debugging with CLion 2019.2. Alas it isn't.

From the debugger's log output, the libc++ pretty printers seem to be installed. When trying to view variables that should use them, however, I get just the basic type information. One thing I notice, which I'm not sure if it is a problem, is that the pretty printers info says they are all in the std:: namespace, whereas while trying to view types, all the types are in the std::__1:: namespace. Is this an issue?

Any other suggestions for things to try?

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.