)]}'
{
  "commit": "9196be90bd9572bd09fad63d7e0b2fa199738b90",
  "tree": "6009da45f3ad53744236ece59699ba7cf974745a",
  "parents": [
    "a4f8c177b46fe96b08a066c159a7a11071095a30"
  ],
  "author": {
    "name": "Bruno Larsen",
    "email": "blarsen@redhat.com",
    "time": "Wed Apr 26 15:09:38 2023 +0200"
  },
  "committer": {
    "name": "Bruno Larsen",
    "email": "blarsen@redhat.com",
    "time": "Tue May 23 10:48:20 2023 +0200"
  },
  "message": "gdb/testsuite: change hardcoded assembly in gdb.arch/disp-step-insn-reloc.exp\n\nWhen testing gdb.arch/disp-step-insn-reloc.exp with clang in an x86_64\nmachine, the compiled test case would segfault when returning from\nthe function can_relocate_call, with a suggestion of a broken stack.\nThe example assembly in the commment was the following:\n\n   f:\n     MOV $1, %[ok]\n     JMP end\n   set_point0:\n     CALL f ; tracepoint here.\n   end:\n\nAnd the segmentation fault happening at the final \"ret\" instruction of\ncan_relocate_call.  Looking at the disassembled version of the later\nhalf of the important function, we see:\n\nClang version (f starting at 11a4):\n  00000000000011ae \u003cset_point0\u003e:\n      11ae:       e8 f1 ff ff ff          callq  11a4 \u003ccan_relocate_call+0x14\u003e\n      11b3:       89 45 fc                mov    %eax,-0x4(%rbp)\n      11b6:       83 7d fc 01             cmpl   $0x1,-0x4(%rbp)\n      11ba:       0f 85 0a 00 00 00       jne    11ca \u003cset_point0+0x1c\u003e\n      11c0:       e8 5b 00 00 00          callq  1220 \u003cpass\u003e\n      11c5:       e9 05 00 00 00          jmpq   11cf \u003cset_point0+0x21\u003e\n      11ca:       e8 61 00 00 00          callq  1230 \u003cfail\u003e\n      11cf:       48 83 c4 10             add    $0x10,%rsp\n      11d3:       5d                      pop    %rbp\n      11d4:       c3                      retq\n      11d5:       66 66 2e 0f 1f 84 00    data16 nopw %cs:0x0(%rax,%rax,1)\n      11dc:       00 00 00 00\n\ngcc version (f starting at 401125):\n  000000000040112c \u003cset_point0\u003e:\n    40112c:       e8 f4 ff ff ff          callq  401125 \u003ccan_relocate_call+0x11\u003e\n    401131:       89 45 fc                mov    %eax,-0x4(%rbp)\n    401134:       83 7d fc 01             cmpl   $0x1,-0x4(%rbp)\n    401138:       75 07                   jne    401141 \u003cset_point0+0x15\u003e\n    40113a:       e8 c7 ff ff ff          callq  401106 \u003cpass\u003e\n    40113f:       eb 05                   jmp    401146 \u003cset_point0+0x1a\u003e\n    401141:       e8 c7 ff ff ff          callq  40110d \u003cfail\u003e\n    401146:       90                      nop\n    401147:       c9                      leaveq\n    401148:       c3                      retq\n\nThe epilogue of set_point0 (11cf for clang, 401146 for gcc) is the main\ndifference: GCC\u0027s version uses the leaveq instruction, which resets rsp\nbased on rbp, while clang adds the same constant to rsp that it\nsubtracted in the prologue.  Clang fails because the return address that\nis added by the \"call f\" instruction isn\u0027t accounted for.\n\nThis commit fixes that by adding a return instruction to f, which leaves\nthe rsp as the compilers would expect.\n\nApproved-By: Andrew Burgess \u003caburgess@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f687c2c5631f535a66a0faa9263729e8281602e7",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.arch/insn-reloc.c",
      "new_id": "365e61800573d00ae3b979d16a7133986d5fcdcb",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.arch/insn-reloc.c"
    }
  ]
}
