[PATCH 4/4] gdb.trace: Fix off-by-one in tfile_fetch_registers.

Marcin Kościelnicki
2016-02-06T15:47:23Z

This resulted in the last register being considered unavailable.
On plain x86_64 (without AVX), this happened to be orig_rax.

gdb/ChangeLog:

* tracefile-tfile.c (tfile_fetch_registers): Fix off-by-one in bounds
check.
---
gdb/ChangeLog | 5 +++++
gdb/tracefile-tfile.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5afdb60..339f2d0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-02-06 Marcin KoÅ›cielnicki <koriakin@0x04.net>

+ * tracefile-tfile.c (tfile_fetch_registers): Fix off-by-one in bounds
+ check.
+
+2016-02-06 Marcin KoÅ›cielnicki <koriakin@0x04.net>
+
* tracefile-tfile.c (tfile_fetch_registers): Use g packet order
instead of gdb order.

diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 23d78c3..a6c3c9c 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -879,7 +879,7 @@ tfile_fetch_registers (struct target_ops *ops,

regsize = register_size (gdbarch, regn);
/* Make sure we stay within block bounds. */
- if (offset + regsize >= trace_regblock_size)
+ if (offset + regsize > trace_regblock_size)
break;
if (regcache_register_status (regcache, regn) == REG_UNKNOWN)
{
--
2.7.0