From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18968 invoked by alias); 25 Mar 2003 23:51:35 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18961 invoked from network); 25 Mar 2003 23:51:34 -0000 Received: from unknown (HELO mail-out1.apple.com) (17.254.0.52) by sources.redhat.com with SMTP; 25 Mar 2003 23:51:34 -0000 Received: from mailgate2.apple.com (A17-129-100-225.apple.com [17.129.100.225]) by mail-out1.apple.com (8.12.8/8.12.8) with ESMTP id h2PNpYOr014656 for ; Tue, 25 Mar 2003 15:51:34 -0800 (PST) Received: from scv2.apple.com (scv2.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Tue, 25 Mar 2003 15:51:34 -0800 Received: from apple.com (inghji.apple.com [17.201.22.240]) by scv2.apple.com (8.11.3/8.11.3) with ESMTP id h2PNpXH21800 for ; Tue, 25 Mar 2003 15:51:33 -0800 (PST) Date: Tue, 25 Mar 2003 23:51:00 -0000 Subject: Re: [rfc breakpoint] Catch exceptions Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) From: Jim Ingham To: gdb-patches@sources.redhat.com Content-Transfer-Encoding: 7bit In-Reply-To: <1048606641.15061.ezmlm@sources.redhat.com> Message-Id: X-SW-Source: 2003-03/txt/msg00507.txt.bz2 One thing we had to worry about at least on Mac OS X is that we don't use a shared libstdc++, rather every shlib that uses C++ get its own copy of all the libsupc++ code. So there are actually many copies of __cxa__begin_catch hanging around. To do this properly, you have to search exhaustively for these symbols, not just take the first hit. Moreover, you have to redo it on every shared library load, or you will miss some. This still might bite you on other systems, for instance if out of paranoia somebody had linked their shlib or executable statically to libstdc++.a (so they wouldn't get bit by changing ABI issues or whatever). BTW. The more general problem of a symbol resolving to multiple instances - for instance setting file:line breakpoints in inlined functions or template method defn's - is something we need to address. It really ticks off our C++ friends. I thought I was going to have time to think about this in the next month or two, but I got sidetracked on other issues. But I will need to get back to it after our WWDC (in June). I thought from some comments in other notes that this was something you were thinking about as well, Daniel. Is that true? Jim On Tuesday, March 25, 2003, at 07:37 AM, gdb-patches-digest-help@sources.redhat.com wrote: > +static int > +handle_gnu_v3_exceptions (int tempflag, char *cond_string, > + enum exception_event_kind ex_event, int from_tty) > +{ > + struct minimal_symbol *trigger_func; > + const char *trigger_func_name; > + struct symtab_and_line sal; > + struct breakpoint *b; > + > + if (ex_event == EX_EVENT_CATCH) > + trigger_func_name = "__cxa_begin_catch"; > + else > + trigger_func_name = "__cxa_throw"; > + > + trigger_func = lookup_minimal_symbol (trigger_func_name, NULL, > NULL); > + if (trigger_func == 0) > + return 0; > + sal = find_msymbol_start_sal (trigger_func, 1); > + > + b = set_raw_breakpoint (sal, bp_breakpoint); > + set_breakpoint_count (breakpoint_count + 1); > + b->number = breakpoint_count; > + b->cond = NULL; > + b->cond_string = (cond_string == NULL) ? > + NULL : savestring (cond_string, strlen (cond_string)); > + b->thread = -1; > + b->addr_string = xstrdup (trigger_func_name); > + b->enable_state = bp_enabled; > + b->disposition = tempflag ? disp_del : disp_donttouch; > + mention (b); > + b->ep_type = ep_gnuv3; > + > + b->print = print_exception_catchpoint; > + b->print_one = print_one_exception_catchpoint; > + b->print_mention = print_mention_exception_catchpoint; > + return 1; > +} > + > -- Jim Ingham jingham@apple.com Developer Tools Apple Computer