koutheir / libcxx-pretty-printers

Moved: https://codeberg.org/koutheir/libcxx-pretty-printers
https://codeberg.org/koutheir/libcxx-pretty-printers
GNU General Public License v3.0
148 stars 51 forks source link

Update printers.py #14

Closed amoshtaghi closed 2 years ago

amoshtaghi commented 2 years ago

Depending on the topology of the red-black tree, the right-hand subtrees are not parsed correctly and repeated entries are printed in gdb. These proposed changes match with the c++ code implementation of libc++::map::iterator
example of a map that produces such tree is posted below. set a breakpoint in gdb on the second for loop and print data. you'll see the wrong output

include

include

include

std::map<std::string, int> data;

const char *names[] = { "toop", "boogh", "khyar", "goje", "jooje", "saat", "cheragh", "ghalam", "medad", "kagaz" };

int main (void) { for (int i = 0; i<10; i++) { data[std::string(names[i])] = i; }

for (auto m : data) { std::cout << m.first <<" "<<m.second <<"\n"; }

return 0; }

koutheir commented 2 years ago

Thank you very much for your efforts, @amoshtaghi!

These proposed changes match with the c++ code implementation of libc++::map::iterator

Can you please point me to the implementation you're referring to, in libcxx?

amoshtaghi commented 2 years ago

https://github.com/llvm-mirror/libcxx/blob/78d6a7767ed57b50122a161b91f59f19c9bd0d19/include/__tree#L180

From: Koutheir Attouchi @.> Date: Friday, January 28, 2022 at 4:44 PM To: koutheir/libcxx-pretty-printers @.> Cc: Moshtaghi, Alireza @.>, Mention @.> Subject: Re: [koutheir/libcxx-pretty-printers] Update printers.py (PR #14) NetApp Security WARNING: This is an external email. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Thank you very much for your efforts, @amoshtaghihttps://github.com/amoshtaghi!

These proposed changes match with the c++ code implementation of libc++::map::iterator

Can you please point me to the implementation you're referring to, in libcxxhttps://github.com/llvm/llvm-project/tree/main/libcxx/?

— Reply to this email directly, view it on GitHubhttps://github.com/koutheir/libcxx-pretty-printers/pull/14#issuecomment-1024772339, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXQOKX23OAOJ3FLYBUSPD4DUYMZ43ANCNFSM5NCCMHIA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>