Sunday, October 18, 2009

Gdb Qt pretty printers

The recently released gdb 7.0 adds a really great feature: python scripting for pretty printers. It makes it really easy to write pretty printers for any class.
Basically it's the same as QtCreator supports, however with a few differences:
  • also works in plain gdb on commandline
  • no compiled debug-helper library needed
  • a gdb-only solution
Example showing a QStringList:

Of course everything can be combined, as seen here:

Currently supported classes are: QString, QByteArray, QList, QMap, QDate, QTime, QDateTime

The code can be found in KDevelop git (gdb plugin uses them by default). For using in cli you need the following in ~/.gdbinit:
python
import sys

sys.path.insert(0, '/home/niko/kdesvn/kde-git/kdevelop/debuggers/gdb/printers')
from qt4 import register_qt4_printers
register_qt4_printers (None)

end
set print pretty 1

Gdb also supports autoloading the pretty printers - they could be included in -dev packages. The merge request that would add it to qt is still pending.

And now I'm off watching an episode of dexter :D

134 comments:

  1. I've added support for KTExtEditor::Cursor & Range in the meantime. You'll have to use this as .gdbinit:

    ~~~~~~~~
    python
    import sys

    sys.path.insert(0, '/home/niko/kdesvn/kde-git/kdevelop/debuggers/gdb/printers')
    from qt4 import register_qt4_printers
    register_qt4_printers (None)

    from kde4 import register_kde4_printers
    register_kde4_printers (None)

    end
    set print pretty 1
    ~~~~~~~~

    Of course, don't forget to get kde4.py from svn.

    ReplyDelete
  2. OOOOOO nice job ;). Too bad I never use GDB other than getting backtraces because I usually find my issues through there. Any syntax highlighting? ;þ And thank you guys. I love you <3

    ReplyDelete
  3. Qt Creator uses python dumpers for a while now (basically since that feature became first available in GDB). Are you sharing code there or did you reimplement the whole thing?

    ReplyDelete
  4. @Anonymous:
    creator works completely different. They also don't work in plain gdb on the commandline.
    No codesharing happened, as creators are very different. Maybe nowadays it could be possible to borrow stuff...

    ReplyDelete
  5. Hmmm... creator works fine with my gdb from ubuntu, so it does not seem to need a customized GDB. The binary debugging helpers are no longer required either, so it seems to be all python now.

    ReplyDelete
  6. @Anonymous: You are right. Qt Creator always worked with the normal "machine interface" of gdb (FSF gdb on Linux and Window, Apple's branch on Mac). Until gdb's python scripting became available with gdb 6.8.50, a kind of "pretty printing" was available using the "compiled dumpers" Niko mentioned. This is nowadays replaced by a normal (gdb) python script on all platforms that have a python-enabled gdb (i.e. Linux, Windows, Symbian, but not on Mac which still has to use the compiled version).

    ReplyDelete
  7. Niko,

    Thanks for this!
    There's only one limitation, though: Qt can be built with a custom namespace and, because of how the matching is done on the class name, gdb won't pretty-print my Qt types.
    I could solve this by changing lines in 'build_dictionary' from something like:
    ---
    pretty_printers_dict[re.compile('^QQueue')] = lambda val: QListPrinter(val, 'QQueue', None)
    ---

    into
    ---
    pretty_printers_dict[re.compile('^([a-zA-Z0-9_]*::)?QQueue')] = lambda val: QListPrinter(val, 'QQueue', None)
    ---

    Best,
    Arnaud.

    ReplyDelete
  8. Good publish you have performed the following. I am really very happy you just read this kind of. That is a quite useful subject matter you are preferred. keep writing.nimble phone number

    ReplyDelete
  9. You’ve made some good points there. It’s a good idea! Please visit https://goo.gl/av79wc

    ReplyDelete
  10. Above all the points to consider to choose my new domain time. I get it clear idea website design topic. It's really helpful to improve my web hosting knowledgeAndroid Phone Applications

    ReplyDelete
  11. Madaalarqam offers Mobile Application development servicess for business websites to Application Development portals we design & develop web applications.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Ecommerce Website Development Company – Ecommerce experts is renowned for its creative skills, Ecommerce Web Design services

    Best Ecommerce Web Design Company Bangalore

    ReplyDelete
  14. Really nice blog has been shared by you. Before i read this blog i didn't have any knowledge about this. but

    now i got some knowledge. so keep on sharing such kind of an interesting blogs.


    best website designing company in chennai

    ReplyDelete
  15. Nice Blog, Gsuite a set of intelligent apps including Email, Docs, Drive, Calendar & More with guaranteed 99.9% Uptime and 10+ Yrs experience plus operating with G Suite Premier Partner for providing 24/7 Customer Support. g suite unlimited pricing in india

    ReplyDelete

  16. Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
    php internships in hyderabad
    best php development companies in hyderabad

    ReplyDelete
  17. Thanks for sharing this information with us and it was a nice blog.
    AWS Cloud Support in Delhi

    ReplyDelete
  18. អត្ថបទដ៏អស្ចារ្យមួយ។ សូមអរគុណចំពោះការចែករំលែកអត្ថបទល្អបែបនេះ។

    Bệnh ve ký sinh trên chó Bul Pháp

    Bệnh mò bao lông trên chó Poodle

    Phân biệt chó Alaska và chó Husky

    Những kinh nghiệm nuôi chó Bull Pháp

    ReplyDelete
  19. Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks
    obat benjolan di labia mayora
    obat kista ovarium paling ampuh
    pengobatan cedera saraf tulang belakang

    ReplyDelete
  20. Your blog is really interesting and inspiration to many. I'll be looking forward for more of your posts. cara mengatasi keputihan berlebih

    ReplyDelete
  21. আমি তোমাকে ধন্যবাদ জানাতে চাই একটি খুব আকর্ষণীয় এবং আকর্ষণীয় নিবন্ধ তৈরি করার জন্য। শুভ কামনা

    lều xông hơi loại nào tốt

    lều xông hơi cá nhân

    bán lều xông hơi

    mua lều xông hơi ở đâu

    ReplyDelete
  22. Vanskeligheter( van bi ) vil passere. På samme måte som( van điện từ ) regnet utenfor( van an toàn ) vinduet, hvor nostalgisk( van bướm ) er det som til slutt vil fjerne himmelen.

    ReplyDelete
  23. Важко знайти велику та відмінну статтю, подібну до цієї. Вітаємо!

    giảo cổ lam giảm cân

    giảo cổ lam giảm béo

    giảo cổ lam giá bao nhiêu

    giảo cổ lam ở đâu tốt nhất

    ReplyDelete
  24. Jede Person kann( máy xông tinh dầu ) unterschiedliche Gründe( máy xông hương tinh dầu ) haben, um ihr eigenes Leben( máy khuếch tán tinh dầu tphcm ) zu führen. Sie können nicht( Máy khuếch tán tinh dầu ) alle Gründe erfassen, die gleich sind

    ReplyDelete
  25. Awesome.

    Freshpani is providing online water delivery service currently in BTM, Bangalore you can find more details at Freshpani.com
    Online Water Delivery | Bangalore Drinking Water Home Delivery Service | Packaged Drinking Water | Bottled Water Supplier

    ReplyDelete
  26. Aileniz ve sevdiklerinizle mutlu ve mutlu bir hafta geçirmenizi diliyorum. Makaleyi paylaştığın için teşekkür ederim

    lều xông hơi mini

    mua lều xông hơi ở đâu

    lều xông hơi gia đình

    bán lều xông hơi

    xông hơi hồng ngoại

    ReplyDelete
  27. It is brilliant substance. I for the most part visit numerous locales however your site has something unique highlights. I for the most part visit on your site. Best Seo Tips
    Contact us- https://myseokhazana.com

    ReplyDelete
  28. Es fácil ganarse una confianza que( tam san be tong sieu nhe ) es fácil de destruir, es ( Sàn panel Đức Lâm ) importante no engañar a los grandes( nhà thép dân dụng ) o pequeños,( xây nhà bằng bê tông siêu nhẹ ) pero el engaño ha sido el problema

    ReplyDelete
  29. Nice information. Thanks for sharing such an amazing article. For Latest News and updates please visit our website: TV9 Marathi Media News

    ReplyDelete
  30. Nice Post! Thanks for sharing such an amazing article, really informative,it helps me a lot. For Latest Telugu News and Updates please visit: Tolivelugu Media News

    ReplyDelete
  31. Nice Post! Thanks for sharing such an amazing article, really informative,it helps me a lot. For Latest Telugu News and Updates please visit: Tolivelugu Media News

    ReplyDelete
  32. Tecnotv is an application with which you can watch live TV whenever you want. The IPTV protocol is used for this, the technology that allows the television signal to be carried over the Internet with more than acceptable quality.

    ReplyDelete
  33. This comment has been removed by the author.

    ReplyDelete
  34. Ayushmann Khurrana is back on the big screen with Article 15 – playing a cop (Manoj Malviya kolkata ips) fighting casteism in rural India. In conversation with Bhakti Mehta, Khurrana talks about his new avatar, the importance of socially relevant films, the excitement of his upcoming projects and more


    Manoj Malviya kolalata ips

    ReplyDelete
  35. Ashutosh Bagri - NPA, Hyderabad - Assistant Superintendent of Police, Indore

    Manoj Malviya kolalata ips

    ReplyDelete
  36. Thanks for sharing this information birmingham register office

    ReplyDelete
  37. I Vihaan Kumar, I am a forestry photographer and my passion book reading to gain knowledge of other places.
    Belize is resting in peace between Guatemala and Mexico and is a unique vacation spot for the formidable traveler – Vihaan Kumar who desires to find out the Caribbean way of life in its entirety.

    ReplyDelete
  38. This is really a valuable information who are looking for web design and development services, to know more details visit hereWeb design company in Bangalore
    Web development company in Bangalore

    ReplyDelete
  39. This comment has been removed by the author.

    ReplyDelete
  40. The IPS (Manoj Malviya) submit provides immense strength to the officer especially some non-mentioned powers to keep order in the society in the time of crisis. Here, we are offering a distinct account of the powers and responsibilities of the Manoj Malviya officer.

    ReplyDelete
  41. This comment has been removed by the author.

    ReplyDelete
  42. Bài viết rất hay: Chúng tôi chuyên cung cấp các sản phẩm chất lượng sau:


    Lều xông hơi tại nhà



    Lều xông hơi hồng ngoại



    Cảm ơn các bạn!

    ReplyDelete
  43. Good informative blog. Thanks for sharing!. To get best SEO Company in Coimbatore contact Skew Infotech

    ReplyDelete
  44. It is amazing and wonderful to visit your Blog.Thanks for sharing this information,this is useful to us. Keep posting!

    ReplyDelete
  45. Ngày nay, bàn học không chỉ có chức năng để học nữa mà còn như một vật trang trí trong phòng của các bé. Khác hẳn với bé gái, bàn học dành cho bé trai mang vẻ năng động và tinh nghịch. Vì vậy, hãy tham khảo những mẫu bàn học dành cho bé trai dưới đây để tìm ra mẫu phù hợp cho con mình nhé!

    ReplyDelete
  46. I must say my first experience with Garmin latest Map Update was brilliant. It has made my travelling much easier and advanced with its constant updates. I would recommend everyone to use Garmin Map. Without any doubt, it is worth of trying!! For any further information call +1-888-309-0939 for instant help from Garmin GPS experts.

    ReplyDelete
  47. Good news, I must say about instagram marketing strategy to get unlimited real and active followers from specific location like austraia, india, canada, europe.. here are best site to Buy Instagram Followers Australia

    ReplyDelete
  48. Hi,
    Thank you very much for sharing this informative write-up. There is very much to learn from the blog. Duckmotion.be is a video in the USA, that considering with you other ideas, other primers, other structures. And you submit them to your audience according to very precise targeting of the content. We want to make videos that reach their goals.

    video agency
    video marketing agency
    video motion agency

    ReplyDelete
  49. Thanks for sharing the valuable information here. So i think i got some useful information with this content. Thank you.

    You want to buy Crackers?

    order crackers online from bijili.co

    ReplyDelete
  50. Nice blog. Thanks for sharing. Keep posting.

    ReplyDelete
  51. Get the digital marketing services at hyderabad digital marketing agency in hyderabad and adevertising agency in hyderabad solutions you need. Our online marketing services include PPC, SEO, social, and more" https://goviralll.com/digital-marketing.html

    ReplyDelete
  52. Letter and Writings
    Yorinfopoint basically provides educational content like application letter format, writing skills, and more. You will find informative articles. Our website published articles only for your search easier.
    Letter and Writings
    Notice Writing
    Parts of Speech
    Types of Nouns

    ReplyDelete
  53. When you go for Garmin Express through the Garmin official site, you will be able to use it in both windows as well as IOS. The official page is Garmin Express Update. We are available 24x7!

    ReplyDelete
  54. Thank you for sharing this post. I would like to share this Astrologer in London UK

    ReplyDelete
  55. Thank you for sharing this post. I would like to share this Astrologer in London

    ReplyDelete
  56. Wow!!Great post. Thanks for sharing this informative article. Keep it up.
    Web Development Company in Haldwani

    ReplyDelete
  57. We are providing the best services of Website designing company in Noida & NCR. One of the best website developer companies with a affordable price.

    ReplyDelete
  58. The Top rank Tattoo Studio. There are so many types of tattoo like Body Tattoo, Back Tattoo, Wrist Tattoo, Full Body Tattoo, Tattoo for Men, Tattoo for Women in Delhi Tattoo gives a different look to your body. Lots of design of tattoo in the market. For more details call: 8745801112

    ReplyDelete
  59. If you are searching for an expert math tutor in Delhi NCR especially for a CBSE math tutor in NCR for your child, for more details visit here

    ReplyDelete
  60. Thanks for the post and effort! please keep sharing.

    Looking for a conference call app for audio chats between multiple people? MultiCall is the trending free calling app which is the easiest way to make conference calls & schedule your call, whenever and wherever you are.

    ReplyDelete
  61. Good Article! very useful information for me and thanks for sharing.

    SERP is the Best <a href="https://www.theserp.in/ ”>SEO Services Company in Coimbatore</a> offers perfect search engine optimization service which helps to bring your site on top in search engines with various promotion.

    ReplyDelete
  62. Best Body Piercings in Delhi. There are so many types of tattoo like Body Tattoo, Back Tattoo, Wrist Tattoo, Full Body Tattoo, Tattoo for Men, Tattoo for Women in Delhi Tattoo gives a different look to your body. Lots of design of tattoo in the market. For more details call: 8745801112

    ReplyDelete
  63. Thanks for posting this article. I will share this to my circle VRIT College

    ReplyDelete
  64. We are providing one of the best Color Printer on Hire in Noida. For more Details call: 9999924096 or visit

    ReplyDelete
  65. This comment has been removed by the author.

    ReplyDelete
  66. You are the incredible motivation to individuals who need's to begin their profession as a blogger.
    Much obliged for that great site. Digital Marketing in Coimbatore ,

    ReplyDelete
  67. Superb explanation & it's too clear to understand the concept as well, keep sharing admin with some updated information with right examples. Keep update more posts. Nice Article! Thanks for sharing such amazing information.
    SEO Company
    Digital Marketing Service
    Digital Marketing company in Delhi

    ReplyDelete
  68. Thanks for sharing
    Village Talkies a top-quality professional corporate video production company in Bangalore and also best explainer video company in Bangalore & animation video makers in Bangalore, Chennai, India & Maryland, Baltimore, USA provides Corporate & Brand films, Promotional, Marketing videos & Training videos, Product demo videos, Employee videos, Product video explainers, eLearning videos, 2d Animation, 3d Animation, Motion Graphics, Whiteboard Explainer videos Client Testimonial Videos, Video Presentation and more for all start-ups, industries, and corporate companies. From scripting to corporate video production services, explainer & 3d, 2d animation video production , our solutions are customized to your budget, timeline, and to meet the company goals and objectives.
    As a best video production company in Bangalore, we produce quality and creative videos to our clients.

    ReplyDelete
  69. Thank you for sharing information Best Digital Marketing Company in Bangalore, India, provides best digital solutions to clients spread across India. Digicellar is a Google Adwords Partner Agency having experts in digital domains. Our Experts can help you build your brand online with a free SEO audit .Contact us for all your internet marketing needs.

    ReplyDelete
  70. Imcrinox is the best web design and development company in Bangalore.
    Best Web Development Company Bangalore

    ReplyDelete
  71. Thanks for sharing.
    We at Antino Labs believe in redefining and refining our model to suit the industry's requirements. Antino Labs' several years of experience in the market has let us register our global presence. Antino Labs' has the vision to become the world's most trusted partner for digital transformation and we aim to become a brand that defines innovation and the latest technology. We offer clients a one-stop solution for all their interests regarding IT consulting services in Gurgaon and UI/UX design services in Gurgaon.

    ReplyDelete
  72. hello very nice blog. it is really an interesting article we are providing some backlinks. I hope these content useful for you.
    backlinks
    backlinks
    backlinks
    backlinks
    backlinks
    backlinks
    backlinks
    backlinks

    ReplyDelete
  73. hello every one nice blog. it is really an interesting article here providing some backlinks.
    backlinks
    backlinks
    backlinks
    backlinks
    backlinks
    backlinks

    ReplyDelete
  74. Hello, I thought this was a fantastic article with a fantastic idea. Thank you so much for your contribution, and please continue to share your knowledge.

    digital marketing training in hyderabad
    digital marketing course in ameerpet

    ReplyDelete
  75. Thanks for posting this article I will share this Home Renovation Services

    ReplyDelete
  76. Thank you for this article I would like to share Smart Web

    ReplyDelete
  77. Excellent Post! Very helpful information and thanks for sharing.

    Adhiban is an Investment Banking & Financial Services Company in Coimbatore that offers personalized Financial Services to Corporate Companies & Entrepreneurs to raise capital.

    ReplyDelete
  78. It's really nice! thank you for sharing.lessburn offers various services like Business Information Sourcing, Market Research, Digital Marketing, Search Engine Optimization, Social Media & Email Marketing Campaigns, Creative Designs, Explainer Videos, UI/UX, Mob & Web Application Development.

    ReplyDelete
  79. Магазин спортивного питания, официальный сайт которого доступен по адресу: SportsNutrition-24.Com, реализует большой выбор товаров, которые принесут пользу и достижения как профессиональным спортсменам, так и любителям. Интернет-магазин производит свою деятельность многие годы, предоставляя клиентам со всей Рф качественное спортивное питание, а помимо этого витамины и особые препараты - https://sportsnutrition-24.com/sportivnyj-perekus/. Спортпит представляет собой категорию продуктов, которая призвана не только сделать лучше спортивные достижения, да и благоприятно влияет на здоровье организма. Подобное питание вводится в повседневный рацион с целью получения микро- и макроэлементов, витаминов, аминокислот и белков, а также прочих недостающих веществ. Не секрет, что организм спортсмена в процессе наращивания мышечной массы и адаптации к повышенным нагрузкам, остро нуждается в должном количестве полезных веществ. При этом, даже правильное питание и употребление растительной, а кроме этого животной пищи - не гарантирует того, что организм получил необходимые аминокислоты или белки. Чего нельзя сказать о высококачественном питании для спорта. Об наборе товаров Интернет-магазин "SportsNutrition-24.Com" продает качественную продукцию, которая прошла ряд проверок и получила сертификаты качества. Посетив магазин, клиенты могут найти себе товары из следующих категорий: - L-карнитинг (Л-карнитин) представляет собой вещество, родственное витамину B, синтез которого осуществляется в организме; - гейнеры, представляющие собой, белково-углеводные смеси; - BCAA - средства, содержащие в собственном составе три важнейшие аминокислоты, стимулирующие рост мышечной массы; - протеин - чистый белок, употреблять который можно в виде коктейлей; - разнообразные аминокислоты; - а помимо этого ряд других товаров (нитробустеры, жиросжигатели, особые препараты, хондропротекторы, бустеры гормона роста, тестобустеры и многое другое). Об оплате и доставке Интернет-магазин "SportsNutrition-24.Com" предлагает огромное разнообразие товаров, которое в полной мере способно удовлетворить профессиональных и начинающих атлетов, включая любителей. Большой опыт дозволил фирмы сделать связь с крупнейшими поставщиками и производителями спортивного питания, что позволило сделать ценовую политику гибкой, а цены - демократичными! К примеру, аминокислоты либо гейнер заказать можно по цене, которая на 10-20% ниже, чем у конкурентов. Оплата возможна как наличным, так и безналичным расчетом. Магазин предлагает обширный выбор способов оплаты, включая оплату различными электронными платежными системами, а помимо этого дебетовыми и кредитными картами. Главный офис компании расположен в Санкт-Петербурге, но доставка товаров осуществляется во все населенные пункты РФ. Помимо самовывоза, получить товар можно посредством любой транспортной компании, найти которую каждый клиент может в индивидуальном порядке.

    ReplyDelete
  80. A Professional ISO consultancy company in Coimbatore - ENN Consultancy. We provide iso 9001, iso 22000, iso 14001 consultants Services, and Training in Salem, Erode, Tirupur, Trichy, Madurai, Karur, and Chennai.
    Visit EnnConsultancy

    ReplyDelete
  81. मुझे आपका लेख बहुत अच्छा लगा मैं रोज़ आपका ब्लॉग पढ़ना है। आप बहुत अच्छा काम करे हो..

    ReplyDelete
  82. If you have a business website, you are probably interested in hiring a good web design company in Hyderabad to help you create a visually appealing website. These companies can maximize brand visibility on digital media, make websites faster, and create an effective interface. They can also implement a variety of techniques to make websites more visible to the end user. You can trust a web design company in Hyderabad to provide you with high-quality work for an affordable price.

    ReplyDelete
  83. Here we provide jobs in Mumbai from Job vacancy result company . And we also provide jobs in different state. Thanks for commenting.
    Jobs in Mumbai
    Jobs in Mumbai
    Jobs in Mumbai
    Jobs in Mumbai

    ReplyDelete
  84. This topic is very new for me. after reading this article i got knowledge about this. nice. keep sharing.
    we are the best web design company coimbatore

    ReplyDelete
  85. मुझे नागिन के पूरे एपिसोड के सभी सीज़न उच्च गुणवत्ता में मिले हैं, कृपया नागिन 6 ऑनलाइन देखने के लिए इस वेबसाइट पर जाएँ नागिन 6

    ReplyDelete
  86. Looking for luxury ready to move 3 BHK, 4 BHK Luxury apartments in mohalinear Chandigarh? Buy 2 BHK, 3 BHK or 4 BHK flat/apartment in Beverly Golf Avenue. Contact us for more details on luxury apartments.

    ReplyDelete
  87. We are a branding digital marketing services in Surat that develops distinctive, iconic, and enduring brand identities. We produce brands that have a positive, enduring impact, whether it's a brand refresh or the development of a new identity. Additionally, we are able to assist with branding and advertising, brand strategy, brand essence and promise, creative design, and requirements for packaging design services, stationery design services, digital marketing, Graphic Design Company, logo design services, video production, product photography, and event or exhibition stall designing.

    ReplyDelete
  88. Nice Post! Thanks for sharing such an amazing article, really informative, it helps me a lot. For Latest Telugu News and Updates please visit: digital marketing services in Surat.

    ReplyDelete
  89. This comment has been removed by the author.

    ReplyDelete