Process record: Log %rax after syscall under amd64-linux

Message ID 1525980536-26548-1-git-send-email-modchipv12@gmail.com
State New, archived
Headers

Commit Message

Andrew D'Addesio May 10, 2018, 7:28 p.m. UTC
  Log the return value after executing a system call instruction, as
we do for other archs (i386-linux, arm-linux, etc.)

gdb/ChangeLog:
2018-05-10  Andrew D'Addesio  <modchipv12@gmail.com>

	* amd64-linux-tdep.c (amd64_linux_syscall_record_common): Record
	%rax.
---
 gdb/amd64-linux-tdep.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Andrew D'Addesio May 11, 2018, 7:42 p.m. UTC | #1
Ah, I should have searched the bugzilla, as there's already a bug
report for this problem from 2016-06-25 by dev.burbrink:

    <https://sourceware.org/bugzilla/show_bug.cgi?id=20300>

So maybe it would be a good idea to add PR20300 to the commit message
and ChangeLog.

Andrew
  

Patch

diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 2bd3d31..917ecf5 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1510,6 +1510,9 @@  amd64_linux_syscall_record_common (struct regcache *regcache,
 
  record_regs:
   /* Record the return value of the system call.  */
+  if (record_full_arch_list_add_reg (regcache, AMD64_RAX_REGNUM))
+    return -1;
+  /* Record registers clobbered by the 'syscall' instruction.  */
   if (record_full_arch_list_add_reg (regcache, AMD64_RCX_REGNUM))
     return -1;
   if (record_full_arch_list_add_reg (regcache, AMD64_R11_REGNUM))