gdb: Avoid warning for the jump command inside an inline function.
authorFelix Willgerodt <felix.willgerodt@intel.com>
Thu, 4 Nov 2021 14:46:45 +0000 (15:46 +0100)
committerFelix Willgerodt <felix.willgerodt@intel.com>
Mon, 8 May 2023 07:19:29 +0000 (09:19 +0200)
commitc239019c9f649867c686204d1ac8947a963784d8
tree9b765b5804823303d0f945b73bca16748da9c88b
parentf35cc0decdd7595b34daa30803038342864b7888
gdb: Avoid warning for the jump command inside an inline function.

When stopped inside an inline function, trying to jump to a different line
of the same function currently results in a warning about jumping to another
function.  Fix this by taking inline functions into account.

Before:
  Breakpoint 1, function_inline (x=510) at jump-inline.cpp:22
  22        a = a + x;             /* inline-funct */
  (gdb) j 21
  Line 21 is not in `function_inline(int)'.  Jump anyway? (y or n)

After:
  Breakpoint 2, function_inline (x=510) at jump-inline.cpp:22
  22        a = a + x;            /* inline-funct */
  (gdb) j 21
  Continuing at 0x400679.

  Breakpoint 1, function_inline (x=510) at jump-inline.cpp:21
  21        a += 1020 + a;                /* increment-funct */

This was regression-tested on X86-64 Linux.

Co-Authored-by: Cristian Sandu <cristian.sandu@intel.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/infcmd.c
gdb/testsuite/gdb.base/jump-inline.c [new file with mode: 0644]
gdb/testsuite/gdb.base/jump-inline.exp [new file with mode: 0644]