Files
binutils-gdb/gdb/testsuite/gdb.base/bp-cond-failure.c
Andrew Burgess 3f3ffaca04 gdb: include location number in breakpoint error message
This commit improves the output of this previous commit:

  commit 2dc3457a45
  Date:   Fri Oct 14 13:22:55 2022 +0100

      gdb: include breakpoint number in testing condition error message

The earlier commit extended the error message:

  Error in testing breakpoint condition:

to include the breakpoint number, e.g.:

  Error in testing breakpoint condition 3:

This commit extends takes this further, and includes the location
number if the breakpoint has multiple locations, so we might now see:

  Error in testing breakpoint condition 3.2:

Just as with how GDB reports a normal breakpoint stop, if a breakpoint
only has a single location then the location number is not included,
this keeps things nice and consistent.

I've extended one of the tests to cover the new functionality.

Approved-By: Pedro Alves <pedro@palves.net>
2023-07-10 10:49:59 +01:00

41 lines
1.0 KiB
C

/* Copyright 2022-2023 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
static inline int __attribute__((__always_inline__))
foo ()
{
return 0; /* Multi-location breakpoint here. */
}
static int __attribute__((noinline))
bar ()
{
int res = foo (); /* Single-location breakpoint here. */
return res;
}
int
main ()
{
int res = bar ();
res = foo ();
return res;
}