This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] libctf: fix spurious error when rolling back to the first snapshot
- From: Jose E.Marchesi <jemarch at sourceware dot org>
- To: bfd-cvs at sourceware dot org, gdb-cvs at sourceware dot org
- Date: 1 Jul 2019 10:15:05 -0000
- Subject: [binutils-gdb] libctf: fix spurious error when rolling back to the first snapshot
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f57cf0e3e357255959d00626bce5c21396e23212
commit f57cf0e3e357255959d00626bce5c21396e23212
Author: Nick Alcock <nick.alcock@oracle.com>
Date: Fri Jun 28 22:11:14 2019 +0100
libctf: fix spurious error when rolling back to the first snapshot
The first ctf_snapshot called after CTF file creation yields a snapshot
handle that always yields a spurious ECTF_OVERROLLBACK error ("Attempt
to roll back past a ctf_update") on ctf_rollback(), even if ctf_update
has never been called.
The fix is to start with a ctf_snapshot value higher than the zero value
that ctf_snapshot_lu ("last update CTF snapshot value") is initialized
to.
libctf/
* ctf-create.c (ctf_create): Fix off-by-one error.
Diff:
---
libctf/ChangeLog | 4 ++++
libctf/ctf-create.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index d07d5dc..1770f99 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,9 @@
2019-06-28 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-create.c (ctf_create): Fix off-by-one error.
+
+2019-06-28 Nick Alcock <nick.alcock@oracle.com>
+
* ctf-impl.h: (struct ctf_strs_writable): New, non-const version of
struct ctf_strs.
(struct ctf_dtdef): Note that dtd_data.ctt_name is unpopulated.
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index 6ab0cf3..24ea114 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -82,7 +82,7 @@ ctf_create (int *errp)
fp->ctf_dvhash = dvhash;
fp->ctf_dtnextid = 1;
fp->ctf_dtoldid = 0;
- fp->ctf_snapshots = 0;
+ fp->ctf_snapshots = 1;
fp->ctf_snapshot_lu = 0;
return fp;