20:10:28 <boeckb> #startmeeting 20:10:28 <zodbot> Meeting started Sat Dec 5 20:10:28 2009 UTC. The chair is boeckb. Information about MeetBot at http://wiki.debian.org/MeetBot. 20:10:28 <zodbot> Useful Commands: #action #agreed #halp #info #idea #link #topic. 20:10:51 <boeckb> #meetingtopic gdb features 20:10:57 <mchua> thanks boeckb! 20:11:13 <boeckb> #topic threaded programs 20:11:38 <boeckb> <example program with 3 threads> 20:11:53 <boeckb> turning on the thread debugging 20:11:59 <boeckb> set non-stop on 20:12:06 <boeckb> set target-async on 20:12:25 <boeckb> these can be added to the gdb config file to be set by default 20:12:45 <boeckb> set breakpoints at main and each of the threads 20:13:01 <boeckb> the "info threads" command gives information about all of the threads that are running 20:14:26 <boeckb> by stepping through the program, "next" steps through the current thread 20:14:41 <boeckb> the other threads do not execute 20:14:55 <boeckb> but only if they hit breakpoints 20:15:11 <boeckb> if there were not breakpoints, they would run because only the main thread is being debugged 20:15:33 <boeckb> the "thread 2" command switchs the thread that is being debugged 20:16:18 <boeckb> to the scond thread (see inf threads for ids) 20:16:39 <boeckb> the "continue &" command backgrounds the current thread 20:17:28 <boeckb> to break a runnign thread, switch to it and use the "interrupt" command 20:18:55 <boeckb> question: with "next &", does the program stop after finishing the backgrounded process of running the next line? 20:20:06 <boeckb> this allows you to do one long-running line and continue doing other commands on other threads 20:21:09 <boeckb> #toppic pretty printing 20:21:13 <boeckb> #topic pretty printing 20:21:26 <boeckb> using a python script to print a cmplex type 20:22:19 <boeckb> <example program> 20:22:43 <boeckb> it uses a deque on strings, a map from int to strings, and a custom data strucure 20:23:03 <boeckb> (c++) 20:23:22 <boeckb> print/r the_map 20:23:36 <boeckb> <messy STL output of internal map details> 20:23:49 <boeckb> (this is without pretty printing) 20:24:04 <boeckb> similar with the_deque 20:24:20 <boeckb> and strings 20:24:36 <boeckb> (data is there, but among other data) 20:24:45 <boeckb> print the_map 20:25:00 <boeckb> { 20:25:07 <boeckb> [23], "hello", 20:25:16 <boeckb> } 20:25:40 <boeckb> these are built-in with gdb now 20:25:46 <boeckb> custom data types 20:26:19 <boeckb> these need pretty printers to display anything other than a dump of member variables 20:26:34 <boeckb> in python: 20:26:45 <boeckb> class with a to_string method 20:27:54 <boeckb> another function which compares the type of the value and uses the class to use the class (returns None otherwise) 20:27:58 <boeckb> then: 20:28:11 <boeckb> gdb.pretty_printers.append(<that function>) 20:28:24 <boeckb> to use in gdb "source mytype.py" 20:28:39 <boeckb> then "print value" will use the pretty printer 20:29:05 <boeckb> pretty printers can be auto loaded 20:29:31 <boeckb> in the same directory as the executable (assume executable named "demo") 20:29:37 <boeckb> demo-gdb.py 20:29:41 <boeckb> it will be auto-sourced 20:30:05 <boeckb> (searching the same directory) 20:30:21 <boeckb> unsure whether other directories can be searched now (will research) 20:30:36 <boeckb> (question from adam jackson) 20:31:15 <boeckb> also would be nice if -debuginfo came with these pretty printers 20:32:57 <boeckb> #topic C++ expression handling 20:33:07 <boeckb> info func Base::Base 20:33:23 <boeckb> prints out all functions matching 20:34:26 <boeckb> (Base has 3 ctors) 20:34:34 <boeckb> print Base::Base 20:34:39 <boeckb> is ambiguous 20:35:05 <boeckb> print Base::Base(void) 20:35:26 <boeckb> prints out the method data (return value, args, pointer) 20:36:17 <boeckb> #topic template handling 20:37:17 <boeckb> ptype will display the rsolved type of a variable 20:37:55 <boeckb> so "ptype mytype<int>" displays the declaration of a template with a certain type 20:38:07 <boeckb> s/certain type/int/ 20:38:30 <boeckb> typedefs will be handed as well 20:38:40 <boeckb> typedef mytype<char> tchar 20:38:48 <boeckb> ptype tchar::member 20:39:32 <boeckb> will display the type of the member with the template specified 20:40:08 <boeckb> question: can you call the instance of a template function if its not in the executable(type not used in it) 20:40:20 <boeckb> ctors wont work, but regular functions should 20:40:29 <boeckb> #topic namespaces 20:41:22 <boeckb> four functions doing different scoping of variables and "using" statements 20:42:45 <boeckb> fully scoped works 20:43:35 <boeckb> and now gdb will pick up on using declarations 20:43:54 <boeckb> so if namespace A has a member x 20:44:00 <boeckb> and a function does using A::x 20:44:09 <boeckb> priint x in that function will print A::x 20:44:24 <boeckb> it used to always need the full scoping 20:44:51 <boeckb> similar with doing using namespace A importing variables 20:45:51 <boeckb> question: how does it work with different gcc versions 20:45:52 <boeckb> ? 20:46:07 <boeckb> older versions may not export the necessary information for gdb 20:46:20 <boeckb> #topic Archer project/team 20:46:33 <boeckb> objective: improve debugging support in Fedora 20:46:41 <boeckb> uses a branch of gdb 20:46:54 <boeckb> patch review process upstream is slower than development speed 20:47:02 <boeckb> but patches are being upstreamed 20:47:20 <boeckb> Fedora uses Archer's gdb 20:48:00 <boeckb> question: is it in F12? 20:48:12 <boeckb> its been here since F11, not sure exactly when the cutoff was in F11 20:48:42 <boeckb> eclipse support is underway 20:48:56 <boeckb> #info http://sourceware.org/gdb 20:49:02 <boeckb> #info http://sourceware.org/gdb/wiki/ProjectArcher 20:49:07 <boeckb> please file bugs 20:49:24 <boeckb> #topic questions 20:49:39 <boeckb> dave: how is gdb on OOo these days? 20:49:49 <boeckb> on the TODO list 20:50:47 <boeckb> ben: are Qt retty printers shipped? 20:51:03 <boeckb> not by default 20:51:47 <boeckb> adam jackson: shipping pretty printers with libraries? 20:51:56 <boeckb> /usr/lib/libfoo.so.0-gdb.py 20:51:59 <boeckb> should work 20:52:09 <boeckb> its a packaging thing 20:52:26 <boeckb> its in the manual 20:52:48 <boeckb> Archer mailing list is open as well for questions 20:53:49 <boeckb> dave: maybe writing python to know about C++ objects is a weak point 20:53:59 <boeckb> how to deal with python backtraces from the pretty printers 20:54:53 <boeckb> its up t developers to write pretty printers for their libraries 20:55:24 <boeckb> wiki pages need written about what maintainers need to do 20:55:52 <boeckb> question: ther languages than python? 20:56:00 <boeckb> possible, but python is what has been worked on 20:56:02 <boeckb> #endmeeting