[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gdb
Subject:    Re: Best way to check whether the "sim" is running standalone or by GDB
From:       Michael Morrell <mmorrell () tachyum ! com>
Date:       2019-09-03 19:26:16
Message-ID: 793aa4b72fb04ad0bbba378d660953ae () tachyum ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic