From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2667 invoked by alias); 2 Aug 2010 00:38:18 -0000 Received: (qmail 2655 invoked by uid 22791); 2 Aug 2010 00:38:17 -0000 X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,RCVD_ILLEGAL_IP X-Spam-Check-By: sourceware.org Received: from imr3.ericy.com (HELO imr3.ericy.com) (198.24.6.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Aug 2010 00:38:13 +0000 Received: from eusaamw0711.eamcs.ericsson.se ([147.117.20.178]) by imr3.ericy.com (8.13.8/8.13.8) with ESMTP id o720c9Ux006425 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Sun, 1 Aug 2010 19:38:10 -0500 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.134]) by eusaamw0711.eamcs.ericsson.se ([147.117.20.178]) with mapi; Sun, 1 Aug 2010 20:38:09 -0400 From: Marc Khouzam To: Hui Zhu CC: "gdb@sourceware.org" Date: Mon, 02 Aug 2010 00:38:00 -0000 Subject: RE: Command for number of cores Message-ID: References: , In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2010-08/txt/msg00000.txt.bz2 >>> p sysconf(_SC_NPROCESSORS_CONF) >> >> How do I get GDB to know about the symbol _SC_NPROCESSORS_CONF? >> >> And when I call sysconf() does it execute on the host or the target? > > This command will let inferior call function sysconf(_SC_NPROCESSORS_CONF= ). > _SC_NPROCESSORS_CONF is a enum. In my pc, it's 83. You can run a > small program that have "printf ("%d", _SC_NPROCESSORS_CONF);" to get > it's value in your target. > > I try "p sysconf(83)" in my part. It works OK. I'm worried that this is not safe. I didn't mention the context before, but I want to have Eclipse figure out = how many cores are on the target it is connected to when debugging. Therefore, hard-codin= g the use of=20 sysconf(83) is not safe since I don't know the host Eclipse will run on, an= d even if I did, I don't know the target of the particular debug session. Maybe 83 is good for most Linux, but I don't think it is a very safe approa= ch. Thanks=20 Marc