Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Debugging YaST ScriptsTips for debugging YaST modulesLadislav SlezákIng.
© Novell Inc. All rights reserved2Debugger in YaSTThere is no debugger in YaSTThere was a simple debugger in the past...So...
© Novell Inc. All rights reserved3Debugging YaSTUse y2log (/var/log/YaST2/y2log)• Put y2milestone() wherever it may be use...
© Novell Inc. All rights reserved4More verbose loggingEnabling debug messagesSet variable Y2DEBUG=1 (ZYPP_FULLLOG=1)Press ...
© Novell Inc. All rights reserved5Debugging in YCPLogging an YCP BacktraceUse -1 as the first parameter in y2loglevel() ca...
© Novell Inc. All rights reserved6Modifying Installation SystemUse /y2update for overriding the current filesYCP interpret...
© Novell Inc. All rights reserved7Modifying Installation SystemUse mount for overlaying the filesMount with -o option can ...
© Novell Inc. All rights reserved8Debugging YaST AgentsFor interactive debugging run/usr/lib/YaST2/bin/y2base stdio scrUse...
© Novell Inc. All rights reserved9Debugging a crashCrash – usually SIGSEGV (11), SIGABORT (6), see y2logBacktrace – probab...
© Novell Inc. All rights reserved10Debugging a crashGNU gdb can be also used debugging YaST*-debuginfo packages are requir...
© Novell Inc. All rights reserved11UI DebuggingDebugging functionsUI::DumpWidgetTree() - dumps UI tree to y2logUI::FakeUse...
© Novell Inc. All rights reserved12Questions?Do you have another tip for debugging?
YaST Debugging
Upcoming SlideShare
Loading in …5
×

YaST Debugging

559 views

Published on

Tips for YaST developers how to debug YaST.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

YaST Debugging

  1. 1. Debugging YaST ScriptsTips for debugging YaST modulesLadislav SlezákIng.
  2. 2. © Novell Inc. All rights reserved2Debugger in YaSTThere is no debugger in YaSTThere was a simple debugger in the past...So how to debug a YaST script?
  3. 3. © Novell Inc. All rights reserved3Debugging YaSTUse y2log (/var/log/YaST2/y2log)• Put y2milestone() wherever it may be useful• Use y2debug() – not logged by default, for details potentially needed• Use y2internal() for testing, remove or change it to y2debug laterUse showy2log colorizer• Command: y2tool showy2log -v -- tail -f• Displays y2log in colors depending on the log level (errors in red...)• Formats YCP structures (lists, maps) – more readable output• Open a separate terminal window with it
  4. 4. © Novell Inc. All rights reserved4More verbose loggingEnabling debug messagesSet variable Y2DEBUG=1 (ZYPP_FULLLOG=1)Press Shift+F7 in the Qt UI (dynamic switching on/offdecreases useless output)Another shortcutShift+Ctrl+Alt+X in Qt UI opens an xterm windowwith shell.(Thats useful when debugging the installer running from the installation medium, in a running system itdoes not make much sense, a terminal can be opened manually very easily.)
  5. 5. © Novell Inc. All rights reserved5Debugging in YCPLogging an YCP BacktraceUse -1 as the first parameter in y2loglevel() cally2internal(-1, “Backtrace:”);2007-10-10 15:21:54 <5> cyclops(14553) [YCP] sound/read_routines.ycp:51 Backtrace:2007-10-10 15:21:54 <5> cyclops(14553) [YCP] sound/read_routines.ycp:157 extractUniqueKey (comment)2007-10-10 15:21:54 <5> cyclops(14553) [YCP] sound/read_routines.ycp:224 read_modprobe (.modprobe_sound)2007-10-10 15:21:54 <5> cyclops(14553) [YCP] Sound.ycp:516 read_save_info ()2007-10-10 15:21:54 <5> cyclops(14553) [YCP] Sound.ycp:710 Sound::ReadModulesConf ()2007-10-10 15:21:54 <5> cyclops(14553) [YCP] sound/wizards.ycp:262 Sound::Read (true)2007-10-10 15:21:54 <5> cyclops(14553) [YCP] clients/sound.ycp:588 CommandLine::Run (cmdline)BreakpointsUse e.g. Popup::Message() callsDo not forget to remove them! (svn diff)
  6. 6. © Novell Inc. All rights reserved6Modifying Installation SystemUse /y2update for overriding the current filesYCP interpreter looks the files up in /y2update, $Y2DIR, $HOME/.yast2and in $PREFIX (/usr)Create e.g. /y2update/clients, copy the file from /usr there, dontforget to compile YCP modules (ycpc -c)Works also for non YCP parts (agents, package-bindings...), very convenientfor debugging YCP clients (clients are reloaded when executed)Use start_shell=1 boot option to modify the system before start
  7. 7. © Novell Inc. All rights reserved7Modifying Installation SystemUse mount for overlaying the filesMount with -o option can be used for overriding the original files:mount -o bind /tmp/foo.ycp /usr/share/YaST2/clients/foo.ycpModifying the installation system (inst-sys)Use Driver UpdateSee dud Linuxrc option, basically any RPM can be added to the installationsystemCreate an addon-productSimilar to y2updateAlso for adding packages to the inst-sys
  8. 8. © Novell Inc. All rights reserved8Debugging YaST AgentsFor interactive debugging run/usr/lib/YaST2/bin/y2base stdio scrUse `Read(.path), `Write(.path,...),`Execute(.path,...), `Dir(.path) commandsinstead of e.g. SCR::Read() in YCP scriptNote: rlwrap (readline wrapper) provides easy editing with history for anycommand line tool, use it this way:rlwrap /usr/lib/YaST2/bin/y2base stdio scr
  9. 9. © Novell Inc. All rights reserved9Debugging a crashCrash – usually SIGSEGV (11), SIGABORT (6), see y2logBacktrace – probably the most valuable information,tells the exact location of the crash and program stackWhen YaST crashes it saves the backtrace to/var/log/YaST2/signal file.Use c++filt tool for converting the internal C++ symbols toa readable form:cat /var/log/YaST2/signal | c++filt(Note: The backtrace is created by a standard glibc function, it is not YaST specific.)
  10. 10. © Novell Inc. All rights reserved10Debugging a crashGNU gdb can be also used debugging YaST*-debuginfo packages are required for full debug outputHow to get a backtrace?Start YaST in gdb debuggergdb /usr/lib/YaST2/bin/y2baserun <module> qtAttach gdb to running YaSTgdb /usr/lib/YaST2/bin/y2base <PID>Reproduce the crashUse bt command in gdbSee http://en.opensuse.org/Bugs/YaST for more details
  11. 11. © Novell Inc. All rights reserved11UI DebuggingDebugging functionsUI::DumpWidgetTree() - dumps UI tree to y2logUI::FakeUserInput() - simulates user input (clicking buttons)
  12. 12. © Novell Inc. All rights reserved12Questions?Do you have another tip for debugging?

×