From patchwork Fri Aug 15 22:56:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 2403 Received: (qmail 10130 invoked by alias); 15 Aug 2014 22:56:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10098 invoked by uid 89); 15 Aug 2014 22:56:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f201.google.com Received: from mail-pd0-f201.google.com (HELO mail-pd0-f201.google.com) (209.85.192.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 15 Aug 2014 22:56:08 +0000 Received: by mail-pd0-f201.google.com with SMTP id g10so831278pdj.0 for ; Fri, 15 Aug 2014 15:56:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=PR7O7L6V7ng9rPC9AHzfv2MtOI/ldIZl6dtniOyNq9A=; b=fGy3q0E22po6VteRcE4AvanYv6do8nDOn48kxtIu9uQMbLjBvIDxxozfGPKkFxXVPP BzgwPsxmtqx/rsdlcaQDQxMsmvKgIENudObd4NumR3ofjTDhcSa90KWq56sz26IxnlR9 Ur8cR6Q3WYmufX6/Fmoc+yitrAD/KLCKMq0XSz9+4OD/7Mkoi00dY+4f/9MlHQ1VAk2A Qi1bwPgPSaFK3Lf6+FAfu825Bk3bMQzuMl3CPti9Uo9r1ZlxEfRlVKy3HsX5s5LQTK7H yRhViY4ijFdv57S18+vQyRArIZqLQ8NrD1D4X+jgt+9TLhE3mcR9oiVS34SeWByr6jfM pKew== X-Gm-Message-State: ALoCoQnXgvq6YVxaMVrCoXAEMX48d+YsIwDp6VTbHzYVCxnRTQf7F9RYItKx4+rlJgkaHCi6elOTPnEia2jrnppvTuW6EPr3LDVHb0qMYVV+k7syLzKyIW20a2k0KIPiFmS0EdGUNUP0 X-Received: by 10.68.135.99 with SMTP id pr3mr1844169pbb.9.1408143366755; Fri, 15 Aug 2014 15:56:06 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id l23si795855yhg.1.2014.08.15.15.56.06 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Aug 2014 15:56:06 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 5C0EC5A44CC for ; Fri, 15 Aug 2014 15:56:06 -0700 (PDT) From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] prologue-single-line-func.exp Date: Fri, 15 Aug 2014 15:56:05 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes 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 * 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 . */ + +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 . + +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"