Re: can't set breakpoint at TFile::TFile() in gdb

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 30 Oct 2007 13:08:41 +0100


Hi Tobias,

Are you using a version of ROOT compiled in debug mode? I do not see any problem under SLC3 and SLC4 in setting a breakpoint in TFile.
See my session below.

Rene Brun

(pcbrun4) [2125] gdb root.exe

GNU gdb Red Hat Linux (6.3.0.0-1.143.el4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library"/lib/tls/libthread_db.so.1".

(gdb) b 'TFile::TFile(char const*, char const*, char const*, int)'
Function "TFile::TFile(char const*, char const*, char const*, int)" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 ('TFile::TFile(char const*, char const*, char const*, int)') pending.
(gdb) r

Starting program: /home/brun/root/bin/root.exe [Thread debugging using libthread_db enabled] [New Thread -1208736064 (LWP 11043)]


ROOT 5.17/05 (trunk_at_20542, Oct 30 2007, 13:01:25 on linux)

CINT/ROOT C/C++ Interpreter version 5.16.27, Oct 25, 2007 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }. root [0] TFile f("tutorials/hsimple.root") Detaching after fork from child process 11046. Breakpoint 2 at 0x1021796: file io/src/TFile.cxx, line 159. Pending breakpoint "'TFile::TFile(char const*, char const*, char const*, int)'" resolved
[Switching to Thread -1208736064 (LWP 11043)]

Breakpoint 2, 0x01021796 in TFile (this=0xa23c6c0,

    fname1=0xa091894 "tutorials/hsimple.root", option=0x10c2796 "",     ftitle=0x10c2796 "", compress=1) at io/src/TFile.cxx:159

159                : TDirectoryFile(), fUrl(fname1,kTRUE), fInfoCache(0)

(gdb)

Tobias Raufer wrote:

> The message below doesn't seem to have gone through the first time. 
> Apologies if you receive this twice.
>
>     Tobi
>
>
> Dear Roottalk,
>
> I am encountering a problem  during debugging some code which uses 
> ROOT classes in gdb.
>
> First of all, I am using root v5-14-00 on Scientific Linux 5.0. I am 
> debugging an executable which uses some ROOT classes like for example 
> TFile. It was built using the -g flag for debugging symbols as was ROOT.
>
> I would like to set a breakpoint at the TFile constructor. I am doing
>
> (gdb) b 'TFile::TFile(char const*, char const*, char const*, int)'
> Breakpoint 6 at 0x20e9ea1a: file include/TVirtualMutex.h, line 77
>
> It sets the breakpoint in TVirtualMutex.h instead of TFile.h. 
> Consequently, when running the program, the debugger never stops at 
> the intended breakpoint. I know for a fact that the above constructor 
> is called by the program.
>
> I assume this has something to do with thread support in ROOT. Is 
> there any way I can set a breakpoint at the intended place?
>
> Sorry if this is a stupid question. I am not very experienced in using 
> gdb.
>
> Cheers,
>     Tobi
>
> ---
> Dr Tobias Raufer
>
> R1,2.90, RAL       
> Chilton, Didcot         
> OX11 0QX, UK    
> +44 1235 778842
> +44 1235 446733  (fax)
> t.m.raufer_at_rl.ac.uk
>
Received on Tue Oct 30 2007 - 13:08:41 CET

This archive was generated by hypermail 2.2.0 : Tue Oct 30 2007 - 17:50:02 CET