prologue-single-line-func.exp
Commit Message
Hi.
This is a new testcase I wrote while debugging pr 17276.
It's standalone so I'm submitting it separately.
It tests whether gdb probably handles skipping passed the prologue
in a function that appears on a single line.
gcc still emits two line number entries for such functions,
one at the first instruction and one at the end of the prologue.
I tried to find an existing test for this, as I figured there
should be one. Alas I couldn't find one.
If it turns out there is indeed an existing test,
I'd suggest either replacing it with this or making it easier to find. :-)
2014-08-15 Doug Evans <dje@google.com>
* gdb.base/prologue-single-line-func.exp: New file.
* gdb.base/prologue-single-line-func.c: New file.
Comments
On Fri, Aug 15, 2014 at 3:56 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> This is a new testcase I wrote while debugging pr 17276.
> It's standalone so I'm submitting it separately.
>
> It tests whether gdb probably handles skipping passed the prologue
Umm,
... properly handles ...
> in a function that appears on a single line.
On 08/16/2014 06:56 AM, Doug Evans wrote:
> I tried to find an existing test for this, as I figured there
> should be one. Alas I couldn't find one.
Neither do I. prologue-include.exp has different purpose from yours.
We may merge yours to prologue.exp, but keep it as a separate test
case is fine to me too.
new file mode 100644
@@ -0,0 +1,24 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2014 Free Software Foundation, Inc.
+
+ 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/>. */
+
+int single_line_func (int x) { return x + 1; }
+
+int
+main (void)
+{
+ return single_line_func (-1);
+}
new file mode 100644
@@ -0,0 +1,36 @@
+# Copyright (C) 2014 Free Software Foundation, Inc.
+
+# 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/>.
+
+standard_testfile
+
+if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+ return -1
+}
+
+if ![runto_main] {
+ fail "Cannot run to main."
+ continue
+}
+
+gdb_test "break single_line_func" \
+ "Breakpoint.*at.* file .*, line.*" \
+ "breakpoint on single line function"
+
+gdb_continue_to_breakpoint "single_line_func"
+
+# Verify we can read function arguments in the single line function,
+# and thus either that we properly skipped passed the prologue,
+# or that the debug info uses location lists for the arguments.
+gdb_test "p x" " = -1"