diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-07-13 20:40:52 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-10-03 17:04:55 +0100 |
commit | 5537f9b9a3c46c3898e274a52f6bb0eb8d293bb8 (patch) | |
tree | 3d1ac035f2c596d2fe567637f99f7380faab4ca6 /include/ctf-api.h | |
parent | d851ecd373a3764581372b10be5b74c9ee98ae08 (diff) | |
download | gdb-5537f9b9a3c46c3898e274a52f6bb0eb8d293bb8.zip gdb-5537f9b9a3c46c3898e274a52f6bb0eb8d293bb8.tar.gz gdb-5537f9b9a3c46c3898e274a52f6bb0eb8d293bb8.tar.bz2 |
libctf: write CTF files to memory, and CTF archives to fds
Before now, we've been able to write CTF files to gzFile descriptors or
fds, and CTF archives to named files only.
Make this a bit less irregular by allowing CTF archives to be written
to fds with the new function ctf_arc_write_fd: also allow CTF
files to be written to a new memory buffer via ctf_write_mem.
(It would be nice to complete things by adding a new function to write
CTF archives to memory, but this is too difficult to do given the short
time the linker is expected to be writing them out: we will transition
to a better format in format v4, though we will always support reading
CTF archives that are stored in .ctf sections.)
include/
* ctf-api.h (ctf_arc_write_fd): New.
(ctf_write_mem): Likewise.
(ctf_gzwrite): Spacing fix.
libctf/
* ctf-archive.c (ctf_arc_write): Split off, and reimplement in terms
of...
(ctf_arc_write_fd): ... this new function.
* ctf-create.c (ctf_write_mem): New.
Diffstat (limited to 'include/ctf-api.h')
-rw-r--r-- | include/ctf-api.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/ctf-api.h b/include/ctf-api.h index fa74788..2bee08b 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -258,6 +258,8 @@ extern void ctf_file_close (ctf_file_t *); extern int ctf_arc_write (const char *, ctf_file_t **, size_t, const char **, size_t); +extern int ctf_arc_write_fd (int, ctf_file_t **, size_t, const char **, + size_t); extern const char *ctf_cuname (ctf_file_t *); extern void ctf_cuname_set (ctf_file_t *, const char *); @@ -379,8 +381,9 @@ extern ctf_snapshot_id_t ctf_snapshot (ctf_file_t *); extern int ctf_rollback (ctf_file_t *, ctf_snapshot_id_t); extern int ctf_discard (ctf_file_t *); extern int ctf_write (ctf_file_t *, int); -extern int ctf_gzwrite (ctf_file_t * fp, gzFile fd); +extern int ctf_gzwrite (ctf_file_t *fp, gzFile fd); extern int ctf_compress_write (ctf_file_t * fp, int fd); +extern unsigned char *ctf_write_mem (ctf_file_t *, size_t *, size_t threshold); extern void ctf_setdebug (int debug); extern int ctf_getdebug (void); |