)]}'
{
  "commit": "5f6ec13ffe8ae4db04419bf66868e082df73634d",
  "tree": "b2234eb09fd9aef12449ce5188d7819e8ca90845",
  "parents": [
    "2e10cefd83b6a5b0b3745da1134d35a4924db6c5"
  ],
  "author": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Wed Jan 25 13:27:03 2023 +0100"
  },
  "committer": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Wed Jan 25 13:27:03 2023 +0100"
  },
  "message": "[gdb/testsuite] Improve leaf fn in gdb.base/unwind-on-each-insn.exp\n\nIn test-case gdb.base/unwind-on-each-insn.exp, we stepi through function foo\nto check various invariants at each insn, in particular hoping to excercise\ninsns that modify stack and frame pointers.\n\nFor x86_64-linux, we have a reasonably complex foo (and similar for -m32):\n...\n  4004bc:       55                      push   %rbp\n  4004bd:       48 89 e5                mov    %rsp,%rbp\n  4004c0:       90                      nop\n  4004c1:       5d                      pop    %rbp\n  4004c2:       c3                      ret\n...\nBoth stack pointer (%rsp) and frame pointer (%rbp) are modified.\n\nAlso for s390x-linux (and similar for -m31):\n...\n0000000001000668 \u003cfoo\u003e:\n 1000668:       e3 b0 f0 58 00 24       stg     %r11,88(%r15)\n 100066e:       b9 04 00 bf             lgr     %r11,%r15\n 1000672:       e3 b0 b0 58 00 04       lg      %r11,88(%r11)\n 1000678:       07 fe                   br      %r14\n...\nFrame pointer (%r11) is modified.\n\nLikewise for powerpc64le-linux:\n...\n00000000100006c8 \u003cfoo\u003e:\n    100006c8:   f8 ff e1 fb     std     r31,-8(r1)\n    100006cc:   d1 ff 21 f8     stdu    r1,-48(r1)\n    100006d0:   78 0b 3f 7c     mr      r31,r1\n    100006d4:   00 00 00 60     nop\n    100006d8:   30 00 3f 38     addi    r1,r31,48\n    100006dc:   f8 ff e1 eb     ld      r31,-8(r1)\n    100006e0:   20 00 80 4e     blr\n...\nBoth stack pointer (r1) and frame pointer (r31) are modified.\n\nBut for aarch64-linux, we have:\n...\n00000000004005fc \u003cfoo\u003e:\n  4005fc:       d503201f        nop\n  400600:       d65f03c0        ret\n...\nThere\u0027s no insn that modifies stack or frame pointer.\n\nFix this by making foo more complex, adding an (unused) argument:\n...\n0000000000400604 \u003cfoo\u003e:\n  400604:       d10043ff        sub     sp, sp, #0x10\n  400608:       f90007e0        str     x0, [sp, #8]\n  40060c:       d503201f        nop\n  400610:       910043ff        add     sp, sp, #0x10\n  400614:       d65f03c0        ret\n...\nsuch that the stack pointer (sp) is modified.\n\n[ Note btw that we\u0027re seeing the effects of -momit-leaf-frame-pointer, with\n-mno-omit-leaf-frame-pointer we have instead:\n...\n0000000000400604 \u003cfoo\u003e:\n  400604:       a9be7bfd        stp     x29, x30, [sp, #-32]!\n  400608:       910003fd        mov     x29, sp\n  40060c:       f9000fa0        str     x0, [x29, #24]\n  400610:       d503201f        nop\n  400614:       a8c27bfd        ldp     x29, x30, [sp], #32\n  400618:       d65f03c0        ret\n...\nsuch that also the frame pointer (x29) is modified. ]\n\nHaving made foo more complex, we now run into the following fail on\nx86_64/-m32:\n...\nFAIL: gdb.base/unwind-on-each-insn.exp: instruction 1: $sp_value \u003d\u003d $main_sp\n....\n\nThe problem is that the stack pointer has changed inbetween the sampling of\nmain_sp and *foo, in particular by the push insn:\n...\n 804841a:       68 c0 84 04 08          push   $0x80484c0\n 804841f:       e8 10 00 00 00          call   8048434 \u003cfoo\u003e\n...\n\nFix this by updating main_sp.\n\nOn powerpc64le-linux, with gcc 7.5.0 I now run into PR tdep/30021:\n...\nFAIL: gdb.base/unwind-on-each-insn.exp: insn 7: $fba_value \u003d\u003d $main_fba\nFAIL: gdb.base/unwind-on-each-insn.exp: insn 7: [string equal $fid $main_fid]\n...\nbut I saw the same failure before this commit with gcc 4.8.5.\n\nTested on:\n- x86_64-linux (-m64 and -m32)\n- s390x-linux (-m64 and -m31)\n- powerpc64le-linux\n- aarch64-linux\n\nAlso I\u0027ve checked that the test-case still functions as regression test for PR\nrecord/16678 on x86_64.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "af9fc11ddabec9134e674bb20eac9efeda5b895a",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c",
      "new_id": "635aa44135e51724c0387f276d15307245839db0",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c"
    },
    {
      "type": "modify",
      "old_id": "60bc83a6d4ff4014d5c1a4e5aefbe35beea1b5f5",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/unwind-on-each-insn.c",
      "new_id": "821df37511584e6caca2324e1e0b47eb4c869a1a",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/unwind-on-each-insn.c"
    },
    {
      "type": "modify",
      "old_id": "fc48bf5c0618fdec0a0bc6b7b6b366d0736240f4",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/unwind-on-each-insn.exp",
      "new_id": "6e68b24af9cb9b952ed9f95dd9ae43cb2f6cbeb0",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/unwind-on-each-insn.exp"
    }
  ]
}
