public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Best way to check whether the "sim" is running standalone or by GDB
@ 2019-08-29  2:15 William Tambe
  2019-08-29 18:05 ` William Tambe
  2021-01-15  6:04 ` Mike Frysinger
  0 siblings, 2 replies; 7+ messages in thread
From: William Tambe @ 2019-08-29  2:15 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Best way to check whether the "sim" is running standalone or by GDB
@ 2019-09-03 19:26 Michael Morrell
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Morrell @ 2019-09-03 19:26 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-15  6:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29  2:15 Best way to check whether the "sim" is running standalone or by GDB William Tambe
2019-08-29 18:05 ` William Tambe
2019-08-30  9:54   ` Nick Clifton
2019-08-30 15:24     ` William Tambe
2019-08-30 16:02       ` Nick Clifton
2021-01-15  6:04 ` Mike Frysinger
2019-09-03 19:26 Michael Morrell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).