* [PATCH] prologue-single-line-func.exp
@ 2014-08-15 22:56 Doug Evans
2014-08-15 23:27 ` Doug Evans
2014-08-18 1:12 ` Yao Qi
0 siblings, 2 replies; 3+ messages in thread
From: Doug Evans @ 2014-08-15 22:56 UTC (permalink / raw)
To: gdb-patches
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.
diff --git a/gdb/testsuite/gdb.base/prologue-single-line-func.c b/gdb/testsuite/gdb.base/prologue-single-line-func.c
new file mode 100644
index 0000000..4648112
--- /dev/null
+++ b/gdb/testsuite/gdb.base/prologue-single-line-func.c
@@ -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);
+}
diff --git a/gdb/testsuite/gdb.base/prologue-single-line-func.exp b/gdb/testsuite/gdb.base/prologue-single-line-func.exp
new file mode 100644
index 0000000..e8f6b75
--- /dev/null
+++ b/gdb/testsuite/gdb.base/prologue-single-line-func.exp
@@ -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"
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] prologue-single-line-func.exp
2014-08-15 22:56 [PATCH] prologue-single-line-func.exp Doug Evans
@ 2014-08-15 23:27 ` Doug Evans
2014-08-18 1:12 ` Yao Qi
1 sibling, 0 replies; 3+ messages in thread
From: Doug Evans @ 2014-08-15 23:27 UTC (permalink / raw)
To: gdb-patches
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] prologue-single-line-func.exp
2014-08-15 22:56 [PATCH] prologue-single-line-func.exp Doug Evans
2014-08-15 23:27 ` Doug Evans
@ 2014-08-18 1:12 ` Yao Qi
1 sibling, 0 replies; 3+ messages in thread
From: Yao Qi @ 2014-08-18 1:12 UTC (permalink / raw)
To: Doug Evans, gdb-patches
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.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-18 1:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-15 22:56 [PATCH] prologue-single-line-func.exp Doug Evans
2014-08-15 23:27 ` Doug Evans
2014-08-18 1:12 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox