This is the mail archive of the
mailing list for the GDB project.
Re: Command for number of cores
On Thu, Jul 29, 2010 at 03:02, Marc Khouzam <firstname.lastname@example.org> wrote:
>> -----Original Message-----
>> From: Hui Zhu [mailto:email@example.com]
>> Sent: Tuesday, July 27, 2010 10:05 PM
>> To: Marc Khouzam
>> Cc: firstname.lastname@example.org
>> Subject: Re: Command for number of cores
>> 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.
>> On Wed, Jul 28, 2010 at 03:55, Marc Khouzam
>> <email@example.com> wrote:
>> > Hi,
>> > I need a way to know how many cores are on my target (where
>> gdbserver is running).
>> > I'm wondering if GDB already has this information?
>> > If not, I was thinking of adding 'info cores' or 'show cores'.
>> > Or maybe a convenience variable '$numcores'?
>> > I'm thinking 'info cores'.
>> > If this makes sense, I'll give it a try.
>> > Thanks
>> > Marc