Re: Best way to check whether the "sim" is running standalone or by GDB

Michael Morrell <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
William,

> What is the best way to check whether the "sim" is running standalone or by GDB ?

In sim_open, the first parameter is "SIM_OPEN_KIND kind".  When sim_open is called in standalone (i.e., from nrun.c), this parameter is SIM_OPEN_STANDALONE) and when called from GDB, it is SIM_OPEN_DEBUG.  This can be saved and checked later.

A typical call in sim_open is:

SIM_DESC sd = sim_state_alloc(kind, callback);

which saves kind in the sd structure.  You can use STATE_OPEN_KIND(sd) to examine it in any function that receives an "sd".

Hope this helps.

   Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.