SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
Debugging of CPD



   Naruhiko Ogasawara
   OpenPrinting Japan

Koedo LUG Offline Meeting
    June 13th, 2009
What is OpenPrinting?

   *nix の印刷関連の標準化を行う団体
   The Linux Foundation の下部組織
   Manager: Till Kamppeter
       元 Mandriva Linux の印刷オタク
       Foomatic という印刷ミドルウェアの開発者
   主な業績
       Open Printing Vector Printing (OPVP)
       PDF Print Path
       Automatic Driver Downloading
       Common Printing Dialog (CPD)
What's Common Printing Dialog?

   Desktop OS ではプリンタの印刷設定について
    OS 側が用意するのが普通
       アプリケーションはどのプリンタについても同じように実
        装することができる
       プリンタベンダは統一された方法でベンダ独自の機能
        をユーザに見せることができる
   *nix にはこれまでそういう仕組みがなかった
       GTK+ / KDE それぞれ持っているが、互換性がない
   それを解消するのが Common Printing Dialog
Demonstration
Problem of CPD

   No Human Resource
       思想は高邁だが、実装する人間がコミュニティに存在し
        ない
       Google Summer of Code だより
   Enough Usability Testing?
       既存の UI とかなり異なる User Experience
       それ自体はいいとして、ちゃんと検証しているのか?
   BUG !  BUG !  BUG !
       結局人がいないので、サンプル実装はバグだらけ
Debug Hacks!

   私は長らく Windows プログラマであった
   *nix についてはよくしらない
       技術者と言うより政治屋
       社内で *nix についてどう対応していくかを考えて関連
        部署を説得するのが仕事
   それじゃつまらん!
       ということで本を
        買いました。
Debugging CPD (KDE ver.)

   CPD の KDE バージョンはプリントキューが一個
    もないと Qt がクラッシュするというナイス不具合
    がある
   半年ぐらい前にバグレポしたのにちっとも治らない
   せっかくなのでこれをデバッグしてみよう!
       とかいってるうちに開発が進んでしまった (6/11 にごっ
        そりコミットされた) ので、このネタはもう古いです。しく
        しく。
   コンパイルなどなどについてはブログ見てください
        http://d.hatena.ne.jp/naruoga/20090527/1243382202
Debugging CPD (KDE ver.) (2)

    とりあえずデーモンもどきを起動して、ダイアログア
     プリを gdb で起動してえいっと実行
    $ kde4­dialog/kde4­cpd &
    $ gdb kde4­dialog/view­dialog
    GNU gdb 6.8­debian
    Copyright (C) 2008 Free Software Foundation, Inc.
    <snip>
    This GDB was configured as quot;i486­linux­gnuquot;...
    (gdb) run
    Starting program: /home/naruhiko/common­printing­dialog/build/kde4­
    dialog/view­dialog 
    [Thread debugging using libthread_db enabled]
    [New Thread 0xb5f19940 (LWP 19299)]
    ASSERT failure in QVector<T>::operator[]: quot;index out of rangequot;, file 
    /usr/include/qt4/QtCore/qvector.h, line 335

    Program received signal SIGABRT, Aborted.
    [Switching to Thread 0xb5f19940 (LWP 19299)]
    0xb800b422 in __kernel_vsyscall () 
Debugging CPD (KDE ver.) (3)

    Qt の QVector クラスの [] オペレータで死んでる
    でもまさかこんな基本クラスがバグってるとは考え
     にくい
    呼出側があやしい!> Backtrace !
    (gdb) bt
    #0  0xb800b422 in __kernel_vsyscall ()
    #1  0xb66286d0 in raise () from /lib/tls/i686/cmov/libc.so.6
    #2  0xb662a098 in abort () from /lib/tls/i686/cmov/libc.so.6
    #3  0xb7658595 in qt_message_output () from /usr/lib/libQtCore.so.4
    #4  0xb7658681 in qFatal () from /usr/lib/libQtCore.so.4
    #5  0xb765872c in qt_assert_x () from /usr/lib/libQtCore.so.4
    #6  0x08064941 in QVector<CommonPrinting::CUPSDestination>::operator[] (
        this=0xa0aef84, i=0) at /usr/include/qt4/QtCore/qvector.h:335
    #7  0x0805dc40 in CPDialogWidget::initWidgets (this=0xa0aef50)
        at /home/naruhiko/common­printing­dialog/kde4­
    dialog/cpd_dialog_widget.cpp:861
    ...
Debugging CPD (KDE ver.) (4)

   人の書いたプログラムなのでロジックを追いたい
   そこでメソッドの先頭に breakpoint して再実行
    (gdb) b CPDialogWidget::initWidgets()

    Breakpoint 1 at 0x805db19: file /home/naruhiko/common­printing­dialog/kde4­dialog/
    cpd_dialog_widget.cpp, line 855.
    (gdb) run
    Starting program: /home/naruhiko/common­printing­dialog/build/kde4­dialog/view­
    dialog 
    [Thread debugging using libthread_db enabled]
    [New Thread 0xb5eac940 (LWP 19668)]
    [Switching to Thread 0xb5eac940 (LWP 19668)]

    Breakpoint 1, CPDialogWidget::initWidgets (this=0x892b120)
        at /home/naruhiko/common­printing­dialog/kde4­dialog/cpd_dialog_widget.cpp:855
    <snip>
    861     currentPrinter = &(printers[0]);
    (gdb) n
    ASSERT failure in QVector<T>::operator[]: quot;index out of rangequot;, file /usr/include/
    qt4/QtCore/qvector.h, line 335

    Program received signal SIGABRT, Aborted.
    0xb7f9e422 in __kernel_vsyscall ()
Debugging CPD (KDE ver.) (5)

   printers[0] の呼び出しで死んでるらしい
   この人 (printers) は何者?
   ちょっと上を見れば分かる
    857     printers = CUPSSupport::getDests();
    (gdb) n
    858     for(int i = 0; i < printers.size(); i++) {
    (gdb) print printers
    $1 = {{p = 0x8070670, d = 0x8070670}}
    (gdb) print printers.size()
    $2 = 0

   CUPSSupport クラスは見てないけど、多分
    Destination ( 印刷先 ) を列挙してベクタに返す
   だから size == 0 になるのも当然
Debugging CPD (KDE ver.) (6)

   Qt のドキュメントをチェック
        http://doc.trolltech.com/4.5/qvector.html#operator-5b-5d

        T & QVector::operator[] ( int i )

        Returns the item at index position i as a modifiable reference.

        i must be a valid index position in the vector (i.e., 0 <= i < size()).
   size() == 0 のときに operator [] 呼んじゃダメ
   だからこのコードの場合 size() == 0 ならアラート
    出して終了するのが一番簡単
Conclusion

   エンジニアを引退した私でも gdb でデバッグでき
    た! しかも楽しい!
       やってみようと思わせた Debug Hacks 素晴らしい
   今度はもっと複雑なバグを追っかけてみたい
   CPD 自体ははやいとこ品質あげてほしいので、こ
    うやってちょこちょこ手伝えたら楽しいかも
   Printing の標準化は人手が足りないので、こういう
    ことに興味がある人ぜひ参加してくださいなっ。

Mais conteúdo relacionado

Mais de Naruhiko Ogasawara

Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)
Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)
Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)Naruhiko Ogasawara
 
宣伝:SeleniumConf Tokyo 2019やりますよ!
宣伝:SeleniumConf Tokyo 2019やりますよ!宣伝:SeleniumConf Tokyo 2019やりますよ!
宣伝:SeleniumConf Tokyo 2019やりますよ!Naruhiko Ogasawara
 
Using latest LibreOffice on openSUSE Leap 15 - by modern packaging systems
Using latest LibreOffice on openSUSE Leap 15 - by modern packaging systemsUsing latest LibreOffice on openSUSE Leap 15 - by modern packaging systems
Using latest LibreOffice on openSUSE Leap 15 - by modern packaging systemsNaruhiko Ogasawara
 
The Document Foundationについて
The Document FoundationについてThe Document Foundationについて
The Document FoundationについてNaruhiko Ogasawara
 
LibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl CultureLibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl CultureNaruhiko Ogasawara
 
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...Naruhiko Ogasawara
 
Hospital days in czech / チェコで入院した話
Hospital days in czech / チェコで入院した話Hospital days in czech / チェコで入院した話
Hospital days in czech / チェコで入院した話Naruhiko Ogasawara
 
openSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE users
openSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE usersopenSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE users
openSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE usersNaruhiko Ogasawara
 
Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...
Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...
Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...Naruhiko Ogasawara
 
LibreOfficeの最新動向 / LibreOffice current status
LibreOfficeの最新動向 / LibreOffice current statusLibreOfficeの最新動向 / LibreOffice current status
LibreOfficeの最新動向 / LibreOffice current statusNaruhiko Ogasawara
 
Vertical Writing: typical use-cases and current status in LibreOffice
Vertical Writing: typical use-cases and current status in LibreOfficeVertical Writing: typical use-cases and current status in LibreOffice
Vertical Writing: typical use-cases and current status in LibreOfficeNaruhiko Ogasawara
 
LibreOffice, the free office productive suite and it's status of accessibilit...
LibreOffice, the free office productive suite and it's status of accessibilit...LibreOffice, the free office productive suite and it's status of accessibilit...
LibreOffice, the free office productive suite and it's status of accessibilit...Naruhiko Ogasawara
 
小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいて
小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいて小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいて
小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいてNaruhiko Ogasawara
 
LibreOffice UI/ ヘルプ翻訳の基礎知識
LibreOffice UI/ ヘルプ翻訳の基礎知識LibreOffice UI/ ヘルプ翻訳の基礎知識
LibreOffice UI/ ヘルプ翻訳の基礎知識Naruhiko Ogasawara
 
OpenStreetMap+MongoDBで地図情報を検索してみたい!
OpenStreetMap+MongoDBで地図情報を検索してみたい!OpenStreetMap+MongoDBで地図情報を検索してみたい!
OpenStreetMap+MongoDBで地図情報を検索してみたい!Naruhiko Ogasawara
 
LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)
LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)
LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)Naruhiko Ogasawara
 
ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...
ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...
ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...Naruhiko Ogasawara
 
MongoDB very basic (Japanese) / MongoDB基礎の基礎
MongoDB very basic (Japanese) / MongoDB基礎の基礎MongoDB very basic (Japanese) / MongoDB基礎の基礎
MongoDB very basic (Japanese) / MongoDB基礎の基礎Naruhiko Ogasawara
 

Mais de Naruhiko Ogasawara (20)

Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)
Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)
Happy Software Freedom Day! (Koedo Linux Users Group, Tokyo, Japan)
 
宣伝:SeleniumConf Tokyo 2019やりますよ!
宣伝:SeleniumConf Tokyo 2019やりますよ!宣伝:SeleniumConf Tokyo 2019やりますよ!
宣伝:SeleniumConf Tokyo 2019やりますよ!
 
Using latest LibreOffice on openSUSE Leap 15 - by modern packaging systems
Using latest LibreOffice on openSUSE Leap 15 - by modern packaging systemsUsing latest LibreOffice on openSUSE Leap 15 - by modern packaging systems
Using latest LibreOffice on openSUSE Leap 15 - by modern packaging systems
 
The Document Foundationについて
The Document FoundationについてThe Document Foundationについて
The Document Foundationについて
 
告知 ー OSnuC Kawagoe 2018
告知 ー OSnuC Kawagoe 2018告知 ー OSnuC Kawagoe 2018
告知 ー OSnuC Kawagoe 2018
 
LibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl CultureLibreOffice: The Office Suite with Mixing Bowl Culture
LibreOffice: The Office Suite with Mixing Bowl Culture
 
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...
Make It Better Together: コミュニティを主体としたLibreOffice翻訳 / : Community-centered Lib...
 
Hospital days in czech / チェコで入院した話
Hospital days in czech / チェコで入院した話Hospital days in czech / チェコで入院した話
Hospital days in czech / チェコで入院した話
 
openSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE users
openSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE usersopenSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE users
openSUSEユーザーに向けたLibreOffice入門 / Introduction of LibreOffice for openSUSE users
 
Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...
Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...
Webブラウザで動くOSSオフィスソフト、LibreOffice Onlineの中身に迫る / LibreOffice Online Implementa...
 
LibreOfficeの最新動向 / LibreOffice current status
LibreOfficeの最新動向 / LibreOffice current statusLibreOfficeの最新動向 / LibreOffice current status
LibreOfficeの最新動向 / LibreOffice current status
 
Vertical Writing: typical use-cases and current status in LibreOffice
Vertical Writing: typical use-cases and current status in LibreOfficeVertical Writing: typical use-cases and current status in LibreOffice
Vertical Writing: typical use-cases and current status in LibreOffice
 
LibreOffice, the free office productive suite and it's status of accessibilit...
LibreOffice, the free office productive suite and it's status of accessibilit...LibreOffice, the free office productive suite and it's status of accessibilit...
LibreOffice, the free office productive suite and it's status of accessibilit...
 
小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいて
小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいて小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいて
小江戸らぐ 第154回飯能河原BBQオフ(春の宴)にいて
 
LibreOffice UI/ ヘルプ翻訳の基礎知識
LibreOffice UI/ ヘルプ翻訳の基礎知識LibreOffice UI/ ヘルプ翻訳の基礎知識
LibreOffice UI/ ヘルプ翻訳の基礎知識
 
LibreOffice in Eastern Asia
LibreOffice in Eastern AsiaLibreOffice in Eastern Asia
LibreOffice in Eastern Asia
 
OpenStreetMap+MongoDBで地図情報を検索してみたい!
OpenStreetMap+MongoDBで地図情報を検索してみたい!OpenStreetMap+MongoDBで地図情報を検索してみたい!
OpenStreetMap+MongoDBで地図情報を検索してみたい!
 
LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)
LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)
LibreOffice Conference 2014 Bern, Switzerland Report (in Japanese)
 
ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...
ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...
ソフトウェアの自由って? & ベルン写真集 & Document Liberation Project紹介 / What's Software Freed...
 
MongoDB very basic (Japanese) / MongoDB基礎の基礎
MongoDB very basic (Japanese) / MongoDB基礎の基礎MongoDB very basic (Japanese) / MongoDB基礎の基礎
MongoDB very basic (Japanese) / MongoDB基礎の基礎
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

How to debug the Common Printing Dialog

  • 1. Debugging of CPD Naruhiko Ogasawara OpenPrinting Japan Koedo LUG Offline Meeting June 13th, 2009
  • 2. What is OpenPrinting?  *nix の印刷関連の標準化を行う団体  The Linux Foundation の下部組織  Manager: Till Kamppeter  元 Mandriva Linux の印刷オタク  Foomatic という印刷ミドルウェアの開発者  主な業績  Open Printing Vector Printing (OPVP)  PDF Print Path  Automatic Driver Downloading  Common Printing Dialog (CPD)
  • 3. What's Common Printing Dialog?  Desktop OS ではプリンタの印刷設定について OS 側が用意するのが普通  アプリケーションはどのプリンタについても同じように実 装することができる  プリンタベンダは統一された方法でベンダ独自の機能 をユーザに見せることができる  *nix にはこれまでそういう仕組みがなかった  GTK+ / KDE それぞれ持っているが、互換性がない  それを解消するのが Common Printing Dialog
  • 5. Problem of CPD  No Human Resource  思想は高邁だが、実装する人間がコミュニティに存在し ない  Google Summer of Code だより  Enough Usability Testing?  既存の UI とかなり異なる User Experience  それ自体はいいとして、ちゃんと検証しているのか?  BUG !  BUG !  BUG !  結局人がいないので、サンプル実装はバグだらけ
  • 6. Debug Hacks!  私は長らく Windows プログラマであった  *nix についてはよくしらない  技術者と言うより政治屋  社内で *nix についてどう対応していくかを考えて関連 部署を説得するのが仕事  それじゃつまらん!  ということで本を 買いました。
  • 7. Debugging CPD (KDE ver.)  CPD の KDE バージョンはプリントキューが一個 もないと Qt がクラッシュするというナイス不具合 がある  半年ぐらい前にバグレポしたのにちっとも治らない  せっかくなのでこれをデバッグしてみよう!  とかいってるうちに開発が進んでしまった (6/11 にごっ そりコミットされた) ので、このネタはもう古いです。しく しく。  コンパイルなどなどについてはブログ見てください http://d.hatena.ne.jp/naruoga/20090527/1243382202
  • 8. Debugging CPD (KDE ver.) (2)  とりあえずデーモンもどきを起動して、ダイアログア プリを gdb で起動してえいっと実行 $ kde4­dialog/kde4­cpd & $ gdb kde4­dialog/view­dialog GNU gdb 6.8­debian Copyright (C) 2008 Free Software Foundation, Inc. <snip> This GDB was configured as quot;i486­linux­gnuquot;... (gdb) run Starting program: /home/naruhiko/common­printing­dialog/build/kde4­ dialog/view­dialog  [Thread debugging using libthread_db enabled] [New Thread 0xb5f19940 (LWP 19299)] ASSERT failure in QVector<T>::operator[]: quot;index out of rangequot;, file  /usr/include/qt4/QtCore/qvector.h, line 335 Program received signal SIGABRT, Aborted. [Switching to Thread 0xb5f19940 (LWP 19299)] 0xb800b422 in __kernel_vsyscall () 
  • 9. Debugging CPD (KDE ver.) (3)  Qt の QVector クラスの [] オペレータで死んでる  でもまさかこんな基本クラスがバグってるとは考え にくい  呼出側があやしい!> Backtrace ! (gdb) bt #0  0xb800b422 in __kernel_vsyscall () #1  0xb66286d0 in raise () from /lib/tls/i686/cmov/libc.so.6 #2  0xb662a098 in abort () from /lib/tls/i686/cmov/libc.so.6 #3  0xb7658595 in qt_message_output () from /usr/lib/libQtCore.so.4 #4  0xb7658681 in qFatal () from /usr/lib/libQtCore.so.4 #5  0xb765872c in qt_assert_x () from /usr/lib/libQtCore.so.4 #6  0x08064941 in QVector<CommonPrinting::CUPSDestination>::operator[] (     this=0xa0aef84, i=0) at /usr/include/qt4/QtCore/qvector.h:335 #7  0x0805dc40 in CPDialogWidget::initWidgets (this=0xa0aef50)     at /home/naruhiko/common­printing­dialog/kde4­ dialog/cpd_dialog_widget.cpp:861 ...
  • 10. Debugging CPD (KDE ver.) (4)  人の書いたプログラムなのでロジックを追いたい  そこでメソッドの先頭に breakpoint して再実行 (gdb) b CPDialogWidget::initWidgets() Breakpoint 1 at 0x805db19: file /home/naruhiko/common­printing­dialog/kde4­dialog/ cpd_dialog_widget.cpp, line 855. (gdb) run Starting program: /home/naruhiko/common­printing­dialog/build/kde4­dialog/view­ dialog  [Thread debugging using libthread_db enabled] [New Thread 0xb5eac940 (LWP 19668)] [Switching to Thread 0xb5eac940 (LWP 19668)] Breakpoint 1, CPDialogWidget::initWidgets (this=0x892b120)     at /home/naruhiko/common­printing­dialog/kde4­dialog/cpd_dialog_widget.cpp:855 <snip> 861 currentPrinter = &(printers[0]); (gdb) n ASSERT failure in QVector<T>::operator[]: quot;index out of rangequot;, file /usr/include/ qt4/QtCore/qvector.h, line 335 Program received signal SIGABRT, Aborted. 0xb7f9e422 in __kernel_vsyscall ()
  • 11. Debugging CPD (KDE ver.) (5)  printers[0] の呼び出しで死んでるらしい  この人 (printers) は何者?  ちょっと上を見れば分かる 857 printers = CUPSSupport::getDests(); (gdb) n 858 for(int i = 0; i < printers.size(); i++) { (gdb) print printers $1 = {{p = 0x8070670, d = 0x8070670}} (gdb) print printers.size() $2 = 0  CUPSSupport クラスは見てないけど、多分 Destination ( 印刷先 ) を列挙してベクタに返す  だから size == 0 になるのも当然
  • 12. Debugging CPD (KDE ver.) (6)  Qt のドキュメントをチェック  http://doc.trolltech.com/4.5/qvector.html#operator-5b-5d T & QVector::operator[] ( int i ) Returns the item at index position i as a modifiable reference. i must be a valid index position in the vector (i.e., 0 <= i < size()).  size() == 0 のときに operator [] 呼んじゃダメ  だからこのコードの場合 size() == 0 ならアラート 出して終了するのが一番簡単
  • 13. Conclusion  エンジニアを引退した私でも gdb でデバッグでき た! しかも楽しい!  やってみようと思わせた Debug Hacks 素晴らしい  今度はもっと複雑なバグを追っかけてみたい  CPD 自体ははやいとこ品質あげてほしいので、こ うやってちょこちょこ手伝えたら楽しいかも  Printing の標準化は人手が足りないので、こういう ことに興味がある人ぜひ参加してくださいなっ。