Command for number of cores

Doug Evans
Wed Jul 28 19:50:00 GMT 2010

On Tue, Jul 27, 2010 at 12:55 PM, Marc Khouzam
<> 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

If this is on linux, the following should work:

(gdb) remote get /proc/cpuinfo foo
(gdb) shell cat foo

Alas it gives:

Remote I/O error: Invalid argument

[lseek on /proc/cpuinfo failing?]
I think that's a bug though (not the lseek failing, but that "remote
get /proc/cpuinfo foo" fails).
If this is linux, and this is indeed a bug and it were fixed, would
that suffice?

I hesitate to add "info cores" because it seems a bit esoteric, and
you'd have to hack gdb, gdbserver, and document it all when "remote
get" could suffice.

More information about the Gdb mailing list