diff options
author | David Edelsohn <dje.gcc@gmail.com> | 1997-05-06 23:38:31 +0000 |
---|---|---|
committer | David Edelsohn <dje.gcc@gmail.com> | 1997-05-06 23:38:31 +0000 |
commit | ea4e44934085a54f6c177855d4ae5b22cfa3cff7 (patch) | |
tree | 0262ce562f95aa3ac657407855df73df89cfe0d5 /sim/common/sim-trace.c | |
parent | 19a2b3005ccf70c29981c421b63d3195f886b03d (diff) | |
download | gdb-ea4e44934085a54f6c177855d4ae5b22cfa3cff7.zip gdb-ea4e44934085a54f6c177855d4ae5b22cfa3cff7.tar.gz gdb-ea4e44934085a54f6c177855d4ae5b22cfa3cff7.tar.bz2 |
* sim-trace.c (trace_uninstall): Don't close a file twice.
Diffstat (limited to 'sim/common/sim-trace.c')
-rw-r--r-- | sim/common/sim-trace.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c index a10be4a..a2eec25 100644 --- a/sim/common/sim-trace.c +++ b/sim/common/sim-trace.c @@ -286,13 +286,22 @@ trace_install (SIM_DESC sd) static void trace_uninstall (SIM_DESC sd) { - int i; + int i,j; for (i = 0; i < MAX_NR_PROCESSORS; ++i) { TRACE_DATA *data = CPU_TRACE_DATA (STATE_CPU (sd, i)); if (TRACE_FILE (data) != NULL) - fclose (TRACE_FILE (data)); + { + /* If output from different cpus is going to the same file, + avoid closing the file twice. */ + for (j = 0; j < i; ++j) + if (TRACE_FILE (CPU_TRACE_DATA (STATE_CPU (sd, j))) + == TRACE_FILE (data)) + break; + if (i == j) + fclose (TRACE_FILE (data)); + } } } |