From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23934 invoked by alias); 30 May 2012 14:26:39 -0000 Received: (qmail 23912 invoked by uid 22791); 30 May 2012 14:26:38 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,KHOP_THREADED,MISSING_HEADERS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from gw1.transmode.se (HELO gw1.transmode.se) (195.58.98.146) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 May 2012 14:25:49 +0000 Received: from mail1.transmode.se (mail1.transmode.se [192.168.201.18]) by gw1.transmode.se (Postfix) with ESMTP id CC3CE258135 for ; Wed, 30 May 2012 16:25:45 +0200 (CEST) In-Reply-To: References: Subject: Re: GDB 7.4 adds shlib_events BPs, casuing problem in debugging vmlinux X-KeepSent: 69216827:F4133E69-C1257A0E:004E9BAC; type=4; name=$KeepSent Cc: gdb@sourceware.org Message-ID: From: Joakim Tjernlund Date: Wed, 30 May 2012 14:26:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII 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: 2012-05/txt/msg00141.txt.bz2 Joakim Tjernlund/Transmode wrote on 2012/05/30 15:47:56: > > Using above gdb I get this when trying to debug a kernel with a BDI2000 emulator: > #> powerpc-softfloat_4.5.3-linux-gnu-gdb vmlinux > GNU gdb (Gentoo 7.4 p1) 7.4 > Copyright (C) 2012 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "--host=i686-pc-linux-gnu --target=powerpc-softfloat_4.5.3-linux-gnu". > For bug reporting instructions, please see: > ... > Reading symbols from /usr/local/src/kenth_os2kernel.git/vmlinux...done. > (gdb) tar remote bdi:2001 > Remote debugging using bdi:2001 > 0xeff80050 in ?? () > (gdb) mon reset > (gdb) cont > Continuing. > Warning: > Cannot insert breakpoint -1. > Error accessing memory address 0xc0000000: Unknown error 4294967295. > > This ia because gdb always inserts a special BP: > > (gdb) maintenance info breakpoints > Num Type Disp Enb Address What > -1 shlib events keep y 0xc0000000 <_stext> inf 1 > > I cannot get rid of this shared lib BP. > Also linux does not use shard libs so why is it inserted in the fist place? > Is there some tweak I can use to disable this BP(patch even)? Found this in solib-svr4.c which I think is the problem: static const char * const bkpt_names[] = { "_start", "__start", "main", NULL }; ... ... if (!current_inferior ()->attach_flag) { for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++) { msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0)) { sym_addr = SYMBOL_VALUE_ADDRESS (msymbol); sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, sym_addr, ¤t_target); create_solib_event_breakpoint (target_gdbarch, sym_addr); return 1; } } } This will insert the above BP just because the symbol _start is present. Seems like there are missing safe guards to avoid the unwanted BP Jocke