From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57304 invoked by alias); 4 May 2015 21:12:41 -0000 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 Received: (qmail 57276 invoked by uid 89); 4 May 2015 21:12:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 May 2015 21:12:40 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 04 May 2015 14:12:38 -0700 X-ExtLoop1: 1 Received: from orsmsx108.amr.corp.intel.com ([10.22.240.6]) by orsmga001.jf.intel.com with ESMTP; 04 May 2015 14:12:39 -0700 Received: from fmsmsx106.amr.corp.intel.com (10.18.124.204) by ORSMSX108.amr.corp.intel.com (10.22.240.6) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 4 May 2015 14:12:38 -0700 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.122]) by FMSMSX106.amr.corp.intel.com ([169.254.5.29]) with mapi id 14.03.0224.002; Mon, 4 May 2015 14:12:37 -0700 From: "Chun, Eric Y" To: "gdb@sourceware.org" Subject: Conditional Breakpoints with Pointers Date: Mon, 04 May 2015 21:12:00 -0000 Message-ID: <64E3233B30622847B1E5ED56D2C1DBF00CACDC9F@FMSMSX108.amr.corp.intel.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2015-05/txt/msg00005.txt.bz2 in gdb, how do i set a conditional breakpoint depending on value of pointer= keeping in mind that i have to check if pointer is null before dereferenci= ng pointer? here is an example of code i'm trying to debug: #include using namespace std; =20=20 int main () { int *i[10]; int *j =3D NULL; int k; =20=20 i[4] =3D new int; *i[4] =3D 8; =20=20 for (k=3D0; k < 10; k++) { j =3D i[k]; } =20=20 return 0; } i set conditional breakpoint at line "j=3Di[k]" but i got a seg fault: (gdb) b 14 if j && *j =3D=3D 8 (gdb) r Starting program: /nfs/blahblah/a.out Failed to read a valid object file image from memory. Program received signal SIGSEGV, Segmentation fault. does anybody know why there is a segfault?