From: Andrew Cagney <ac131313@redhat.com>
To: Joern Rennecke <joern.rennecke@superh.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: Add ftruncate support to newlib/gdb-sim to unbreak -fprofile-arcs
Date: Sat, 11 Oct 2003 17:35:00 -0000 [thread overview]
Message-ID: <3F883F45.7040702@redhat.com> (raw)
In-Reply-To: <200307091927.h69JRfs29157@linsvr3.uk.superh.com>
(Picking patches that were allowed to slip to the floor 6.0 :-()
> gdb:
> sim/common:
> * callback.c (os_ftruncate, os_truncate): New functions.
> (default_callback): Initialize ftruncate and truncate members.
> sim/sh:
> * syscall.h (SYS_truncate, SYS_ftruncate): Define.
> * interp.c (trap): Add support for SYS_ftruncate and SYS_truncate.
Joern, yes, ok.
Andrew
> Index: gdb/callback.h
> ===================================================================
> RCS file: /cvs/src/src/include/gdb/callback.h,v
> retrieving revision 1.1
> diff -p -r1.1 callback.h
> *** gdb/callback.h 9 Jun 2002 15:45:43 -0000 1.1
> --- gdb/callback.h 9 Jul 2003 18:48:30 -0000
> *************** struct host_callback_struct
> *** 93,98 ****
> --- 93,100 ----
> void (*flush_stderr) PARAMS ((host_callback *));
> int (*stat) PARAMS ((host_callback *, const char *, struct stat *));
> int (*fstat) PARAMS ((host_callback *, int, struct stat *));
> + int (*ftruncate) PARAMS ((host_callback *, int, long));
> + int (*truncate) PARAMS ((host_callback *, const char *, long));
>
> /* When present, call to the client to give it the oportunity to
> poll any io devices for a request to quit (indicated by a nonzero
> Index: common/callback.c
> ===================================================================
> RCS file: /cvs/src/src/sim/common/callback.c,v
> retrieving revision 1.5
> diff -p -r1.5 callback.c
> *** common/callback.c 9 Jun 2002 15:45:45 -0000 1.5
> --- common/callback.c 9 Jul 2003 18:48:57 -0000
> *************** os_fstat (p, fd, buf)
> *** 399,404 ****
> --- 399,428 ----
> return wrap (p, fstat (fdmap (p, fd), buf));
> }
>
> + static int
> + os_ftruncate (p, fd, len)
> + host_callback *p;
> + int fd;
> + long len;
> + {
> + int result;
> +
> + result = fdbad (p, fd);
> + if (result)
> + return result;
> + result = wrap (p, ftruncate (fdmap (p, fd), len));
> + return result;
> + }
> +
> + static int
> + os_truncate (p, file, len)
> + host_callback *p;
> + const char *file;
> + long len;
> + {
> + return wrap (p, stat (file, len));
> + }
> +
> static int
> os_shutdown (p)
> host_callback *p;
> *************** host_callback default_callback =
> *** 537,542 ****
> --- 561,569 ----
>
> os_stat,
> os_fstat,
> +
> + os_ftruncate,
> + os_truncate,
>
> os_poll_quit,
>
> Index: sh/interp.c
> ===================================================================
> RCS file: /cvs/src/src/sim/sh/interp.c,v
> retrieving revision 1.9
> diff -p -r1.9 interp.c
> *** sh/interp.c 27 Feb 2003 23:26:34 -0000 1.9
> --- sh/interp.c 9 Jul 2003 18:48:57 -0000
> *************** trap (i, regs, insn_ptr, memory, maskl,
> *** 1151,1156 ****
> --- 1151,1167 ----
> case SYS_time:
> regs[0] = get_now ();
> break;
> + case SYS_ftruncate:
> + regs[0] = callback->ftruncate (callback, regs[5], regs[6]);
> + break;
> + case SYS_truncate:
> + {
> + int len = strswaplen (regs[5]);
> + strnswap (regs[5], len);
> + regs[0] = callback->truncate (callback, ptr (regs[5]), regs[6]);
> + strnswap (regs[5], len);
> + break;
> + }
> default:
> regs[0] = -1;
> break;
> Index: sh/syscall.h
> ===================================================================
> RCS file: /cvs/src/src/sim/sh/syscall.h,v
> retrieving revision 1.2
> diff -p -r1.2 syscall.h
> *** sh/syscall.h 30 Jan 2001 23:03:56 -0000 1.2
> --- sh/syscall.h 9 Jul 2003 18:48:58 -0000
> ***************
> *** 27,32 ****
> --- 27,34 ----
> #define SYS_stat 38
> #define SYS_pipe 42
> #define SYS_execve 59
> + #define SYS_truncate 129
> + #define SYS_ftruncate 130
> #define SYS_argc 172
> #define SYS_argnlen 173
> #define SYS_argn 174
>
prev parent reply other threads:[~2003-10-11 17:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-09 19:27 Joern Rennecke
2003-07-09 20:02 ` Nathan Sidwell
2003-07-09 20:12 ` Joern Rennecke
2003-07-09 20:42 ` J. Johnston
2003-10-11 17:35 ` Andrew Cagney [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F883F45.7040702@redhat.com \
--to=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=joern.rennecke@superh.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox