diff options
author | Joern Rennecke <joern.rennecke@arc.com> | 2009-09-11 04:45:40 +0000 |
---|---|---|
committer | Joern Rennecke <joern.rennecke@arc.com> | 2009-09-11 04:45:40 +0000 |
commit | c0b9c0330ac498673282832d8714d013569ca986 (patch) | |
tree | 7524276d1d63cb4ab23038ae8361a0228325863a /sim/common/syscall.c | |
parent | 139d19ee035d132be681a95ece3bbe230664ea9c (diff) | |
download | gdb-c0b9c0330ac498673282832d8714d013569ca986.tar.gz |
gdb/insight for ARCompact (from Richard Stuckey)arc-insight_6_8-branch
Diffstat (limited to 'sim/common/syscall.c')
-rw-r--r-- | sim/common/syscall.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sim/common/syscall.c b/sim/common/syscall.c index b0b98b53f15..e2a1e0168d9 100644 --- a/sim/common/syscall.c +++ b/sim/common/syscall.c @@ -291,7 +291,11 @@ cb_syscall (cb, sc) while (count > 0) { - if (cb_is_stdin (cb, fd)) + /* ??? Actually making target descriptors 0 / 1 / 2 map directly + to stdin / stdout / stderr gets the semantics of freopen + wrong. When using default callbacks, this is re-mapped + in callback.c */ + if (fd == 0) result = (int) (*cb->read_stdin) (cb, buf, (count < FILE_XFR_SIZE ? count : FILE_XFR_SIZE)); @@ -344,12 +348,20 @@ cb_syscall (cb, sc) errcode = EINVAL; goto FinishSyscall; } - if (cb_is_stdout(cb, fd)) + /* Don't treat descriptors 0 / 1 / 2 specially, as their + meaning might have been changed by freopen, as in + 27_io/objects/char/12048-[1-4].cc . */ + + /* ??? Actually making target descriptors 0 / 1 / 2 map directly + to stdin / stdout / stderr gets the semantics of freopen + wrong. When using default callbacks, this is re-mapped + in callback.c */ + if (fd == 1) { result = (int) (*cb->write_stdout) (cb, buf, bytes_read); (*cb->flush_stdout) (cb); } - else if (cb_is_stderr(cb, fd)) + else if (fd == 2) { result = (int) (*cb->write_stderr) (cb, buf, bytes_read); (*cb->flush_stderr) (cb); |