From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28356 invoked by alias); 12 Apr 2008 23:12:42 -0000 Received: (qmail 28347 invoked by uid 22791); 12 Apr 2008 23:12:42 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.25) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 12 Apr 2008 23:12:17 +0000 Received: from kahikatea.snap.net.nz (182.63.255.123.dynamic.snap.net.nz [123.255.63.182]) by viper.snap.net.nz (Postfix) with ESMTP id 0BA293DA205; Sun, 13 Apr 2008 11:12:15 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 1000) id CE0D18FC6D; Sun, 13 Apr 2008 11:12:07 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18433.16837.203782.236874@kahikatea.snap.net.nz> Date: Sun, 13 Apr 2008 06:13:00 -0000 To: "Marty Leisner" Cc: gdb@sourceware.org Subject: Re: breaking on open(2) on linux In-Reply-To: <200804122237.m3CMbtfl022914@dell2.home> References: <200804122237.m3CMbtfl022914@dell2.home> X-Mailer: VM 7.19 under Emacs 23.0.60.70 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00104.txt.bz2 Marty Leisner writes: > I've used gdb for 20 years...I've found the ability to > break on a system call and then backtrace very useful when > reverse engineering code > > Now, I can't do it (not sure when I last could -- I recall its been > a problem before, but I worked around it). > > strace shows open(2) calls... The breakpoint is probably being set elsewhere, e.g. open in libpthread.so To find out do: (gdb) inf addr open Symbol "open" is at 0xb77e69c0 in a file compiled without debugging. (gdb) inf sharedlibrary ... 0xb7800450 0xb784b444 Yes /usr/lib/libglib-2.0.so.0 0xb77de250 0xb77e9264 Yes /lib/tls/i686/cmov/libpthread.so.0 ^^^^^^^^^^^^^^^^^^^^^^ 0xb77d3150 0xb77d7bd4 Yes /usr/lib/libSM.so.6 ... You probably want the one here: 0xb74abca0 0xb75a3306 Yes /lib/tls/i686/cmov/libc.so.6 I don't know the official way to get round this but you could do (gdb) set auto-solib-add off (gdb) start (gdb) share libc.so (gdb) b open to set the breakpoint where you want it. -- Nick http://www.inet.net.nz/~nickrob