From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8988 invoked by alias); 12 Aug 2004 01:13:39 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 8981 invoked from network); 12 Aug 2004 01:13:38 -0000 Received: from unknown (HELO relay0.EECS.Berkeley.EDU) (169.229.60.163) by sourceware.org with SMTP; 12 Aug 2004 01:13:38 -0000 Received: from gateway.EECS.Berkeley.EDU (nsmail@gateway.EECS.Berkeley.EDU [169.229.60.73]) by relay0.EECS.Berkeley.EDU (8.13.0/8.12.10) with ESMTP id i7C1DbYW014073 for ; Wed, 11 Aug 2004 18:13:37 -0700 (PDT) Received: from eecs.berkeley.edu (dhcp-33-87.EECS.Berkeley.EDU [128.32.33.87]) by gateway.EECS.Berkeley.EDU (Netscape Messaging Server 4.15) with ESMTP id I2B7EN00.34X for ; Wed, 11 Aug 2004 18:13:35 -0700 Message-ID: <411AC515.4080002@eecs.berkeley.edu> Date: Thu, 12 Aug 2004 01:13:00 -0000 From: "Allen Hopkins" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: Can't set bkpt at throw statement Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00191.txt.bz2 I have two essentially identical C++ classes with essentially identical methods that both throw the same exception. In gdb, I'm able to set a breakpoint at the "throw" statement in one class, but not in the other. Here are the break commands, first on the one that succeeds, then on the one that fails: (gdb) break Ethel.cpp:12 Breakpoint 1 at 0x80488b5: file Ethel.cpp, line 12. (gdb) break Fred.cpp:12 Note: breakpoint -1 (disabled) also set at pc 0x0. Breakpoint 2 at 0x0: file Fred.cpp, line 12. (gdb) run Starting program: /tmp/allenh/metro_dev/examples/stuck/run.x Warning: Cannot insert breakpoint 2. Error accessing memory address 0x0: Input/output error. Here is a shar of a simple demo of the problem. You can also find these files at http://www.eecs.berkeley.edu/~allenh/stuck. Any advice may help save my sanity. Thanks. -Allen Hopkins # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # DaBomb.h # demo # Ethel.cpp # Ethel.h # Fred.cpp # Fred.h # gdbrc # main.cpp # makefile # echo x - DaBomb.h sed 's/^X//' >DaBomb.h << 'END-of-DaBomb.h' X#ifndef DABOMB_H X#define DABOMB_H X Xclass DaBomb {}; X X#endif END-of-DaBomb.h echo x - demo sed 's/^X//' >demo << 'END-of-demo' X#!/bin/sh X Xmake Xrun.x Xgdb -x gdbrc run.x X END-of-demo echo x - Ethel.cpp sed 's/^X//' >Ethel.cpp << 'END-of-Ethel.cpp' X#include "Ethel.h" X#include "DaBomb.h" X#include X XEthel::Ethel(int i) { X trigger = i; X}; X Xvoid Ethel::myFunc(int i) X{ X if (i == trigger) { X throw DaBomb(); X } else { X cout << "Ethel says " << i << endl; X } X}; END-of-Ethel.cpp echo x - Ethel.h sed 's/^X//' >Ethel.h << 'END-of-Ethel.h' X#ifndef ETHEL_H X#define ETHEL_H X Xclass Ethel; X Xclass Ethel { X public: X int trigger; X Ethel(int i); X void myFunc(int i); X}; X X#endif END-of-Ethel.h echo x - Fred.cpp sed 's/^X//' >Fred.cpp << 'END-of-Fred.cpp' X#include "Fred.h" X#include "DaBomb.h" X#include X XFred::Fred(int i) { X trigger = i; X}; X Xvoid Fred::myFunc(int i) X{ X if (i == trigger) { X throw DaBomb(); X } else { X cout << "Fred says " << i << endl; X } X}; END-of-Fred.cpp echo x - Fred.h sed 's/^X//' >Fred.h << 'END-of-Fred.h' X#ifndef FRED_H X#define FRED_H X Xclass Fred; X Xclass Fred { X public: X int trigger; X Fred(int i); X void myFunc(int i); X}; X X#endif END-of-Fred.h echo x - gdbrc sed 's/^X//' >gdbrc << 'END-of-gdbrc' Xbreak Fred.cpp:12 Xbreak Ethel.cpp:12 Xrun END-of-gdbrc echo x - main.cpp sed 's/^X//' >main.cpp << 'END-of-main.cpp' X#include "Fred.h" X#include "Ethel.h" X#include "DaBomb.h" X#include X Xint main(int argc, char* argv[]) X{ X Fred* fred = new Fred(3); X Ethel* ethel = new Ethel(7); X X for (int i = 0; i < 10; i++) { X X try { X fred->myFunc(i); X } catch (DaBomb) { X cout << "FRED threw DaBomb." << endl; X } X X try { X ethel->myFunc(i); X } catch (DaBomb) { X cout << "ETHEL threw DaBomb." << endl; X } X } X} END-of-main.cpp echo x - makefile sed 's/^X//' >makefile << 'END-of-makefile' XOPTS = -ggdb -Wno-deprecated X Xall: Ethel.o Fred.o main.o X g++ $(OPTS) -o run.x \ X Ethel.o Fred.o main.o X XEthel.o: Ethel.cpp Ethel.h X g++ $(OPTS) -c Ethel.cpp X XFred.o: Fred.cpp Fred.h X g++ $(OPTS) -c Fred.cpp X Xmain.o: ./main.cpp X g++ $(OPTS) -c ./main.cpp X Xclean: X rm -f *.o run.x END-of-makefile exit