RE: Command for number of cores

Marc Khouzam
2010-07-29T20:27:25Z

> -----Original Message-----
> From: Doug Evans [mailto:dje@google.com]
> Sent: Wednesday, July 28, 2010 3:50 PM
> To: Marc Khouzam
> Cc: gdb@sourceware.org
> Subject: Re: Command for number of cores
>
> 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

I see that too.
Note that it only fails for /proc/cpuinfo, not for a
'regular' file.

> [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?

Yes, it is for linux.
And I think that would be enough. This is needed by eclipse, but I
can have it give this series of commands.

Thanks for the suggestion

> 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.
>