Re: Command for number of cores

Doug Evans
2010-07-28T19:50:53Z

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

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.