necessary step

  • file and libs should be compiled with -g

not tested

  • gdb core
    • debug program and core file which produced when core dump

commands

  • gdb topStudy.exe
    • start to debug executable topStudy.exe
  • set args -wpola
    • set program argument as "-wpola"
  • show args
    • show the setted argument
  • run
    • start to run topStudy.exe with args "-wpola"
  • b Wpol::computeCorrectionFunction
    • stop when met function b computeCorrectionFunction of class Wpol, gdb will find which file it belongs to
  • b DrawTool::setCanvas
    • same as above, this function is defined in share lib, still usable.
  • info break
    • print all break point infomation
  • print xx
    • print the variable value
  • bt
    • print the trace of the function from "main" to the current function

debug option

  • add -g -O0 when compiling original code:
    • -g produce debug info
    • -O0 optimization option

debug dynamic lib

  • make sure program can be ran ( all env are correctly set)
  • gdb
  • breakpoint //function can be in the lib, e.g. class::func . gdb will ask you "Make breakpoint pending on future shared library load? (y or [n]) " answer y.
  • run // it will stop at the breakpoint.,

-- ChengguangZhu - 06-Mar-2012

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2015-01-05 - ChengguangZhu
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback