Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Keith Seitz <keiths@redhat.com>
Cc: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [RFA 1/2] Linespec rewrite (update 2)
Date: Tue, 27 Mar 2012 15:05:00 -0000	[thread overview]
Message-ID: <20120327150528.GE2701@adacore.com> (raw)
In-Reply-To: <20120327145425.GD2701@adacore.com>

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

> I am almost done with the extension of operator_bp.exp; I'll send it
> when I've removed all the typos and thinkos...

Here it is... As expected, it fails on HEAD, so cannot commit just
yet. But PASSes with your previous iteration of the patch series,
and now fails...

Thanks, Keith.
-- 
Joel

[-- Attachment #2: 0001-Add-more-tests-to-gdb.ada-operator_bp.exp.patch --]
[-- Type: text/x-diff, Size: 6745 bytes --]

From 88358dd0af5a781493eb5e98666f28b8bd486391 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 27 Mar 2012 07:37:31 -0700
Subject: [PATCH] Add more tests to gdb.ada/operator_bp.exp

This patch adds testing of the FILE:OP:LINENO linespec (where OP is
the name of an Ada operator) as well as testing of the FILE:OP
linespec.

gdb/testsuite/ChangeLog:

        * gdb.ada/operator_bp/ops.adb: Add source line markers.
        * gdb.ada/operator_bp.exp: Add testing of FILE:OP:LINENO
        as well as FILE:OP linespecs where OP is the name of an
        Ada operator.
---
 gdb/testsuite/gdb.ada/operator_bp.exp     |   57 +++++++++++++++++++++++++++++
 gdb/testsuite/gdb.ada/operator_bp/ops.adb |   36 +++++++++---------
 2 files changed, 75 insertions(+), 18 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/operator_bp.exp b/gdb/testsuite/gdb.ada/operator_bp.exp
index 18cf46d..3c20f39 100644
--- a/gdb/testsuite/gdb.ada/operator_bp.exp
+++ b/gdb/testsuite/gdb.ada/operator_bp.exp
@@ -88,4 +88,61 @@ foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "
              "continue to ops.\"$op\""
 }
 
+# Repeat the test, but qualify the operators with a filename and
+# line number.
+
+clean_restart ${testfile}
+
+runto "ops_test.adb:$bp_location"
+
+foreach op { "+" "-" } {
+    set lineno [gdb_get_line_number "STOP \"$op\"" ${testdir}/ops.adb]
+    set op_re [string_to_regexp $op]
+    gdb_test "break ops.adb:\"$op\":$lineno" \
+             "Breakpoint $decimal at $hex: ops\\.adb:\"$op_re\":$lineno\. \\(2 locations\\)"
+}
+
+foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
+    set lineno [gdb_get_line_number "STOP \"$op\"" ${testdir}/ops.adb]
+    set op_re [string_to_regexp $op]
+    gdb_test "break ops.adb:\"$op\":$lineno" \
+             "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal."
+}
+
+# Make sure we stop correctly in each operator function.
+
+foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
+    set op_re [string_to_regexp $op]
+    gdb_test "continue" \
+             "Breakpoint $decimal, ops\\.\"$op_re\" .*"\
+             "continue to ops.adb:\"$op\":LINE"
+}
+
+# Repeat the test, but qualify the operators with a filename alone.
+
+clean_restart ${testfile}
+
+runto "ops_test.adb:$bp_location"
+
+foreach op { "+" "-" } {
+    set op_re [string_to_regexp $op]
+    gdb_test "break ops.adb:\"$op\"" \
+             "Breakpoint $decimal at $hex: ops\\.adb:\"$op_re\". \\(2 locations\\)"
+}
+
+foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
+    set op_re [string_to_regexp $op]
+    gdb_test "break ops.adb:\"$op\"" \
+             "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal."
+}
+
+# Make sure we stop correctly in each operator function.
+
+foreach op { "+" "-" "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
+    set op_re [string_to_regexp $op]
+    gdb_test "continue" \
+             "Breakpoint $decimal, ops\\.\"$op_re\" .*"\
+             "continue to ops.adb:\"$op\""
+}
+
 
diff --git a/gdb/testsuite/gdb.ada/operator_bp/ops.adb b/gdb/testsuite/gdb.ada/operator_bp/ops.adb
index e7d94dc..fe9168c 100644
--- a/gdb/testsuite/gdb.ada/operator_bp/ops.adb
+++ b/gdb/testsuite/gdb.ada/operator_bp/ops.adb
@@ -22,38 +22,38 @@ package body Ops is
 
    function "+" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) + IntRep (I2));
+      return Int (IntRep (I1) + IntRep (I2));  -- STOP "+"
    end;
 
    function "-" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) - IntRep (I2));
+      return Int (IntRep (I1) - IntRep (I2));  -- STOP "-"
    end;
 
    function "*" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) * IntRep (I2));
+      return Int (IntRep (I1) * IntRep (I2));  -- STOP "*"
    end;
 
    function "/" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) / IntRep (I2));
+      return Int (IntRep (I1) / IntRep (I2));  -- STOP "/"
    end;
 
    function "mod" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) mod IntRep (I2));
+      return Int (IntRep (I1) mod IntRep (I2));  -- STOP "mod"
    end;
 
    function "rem" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) rem IntRep (I2));
+      return Int (IntRep (I1) rem IntRep (I2));  -- STOP "rem"
    end;
 
    function "**" (I1, I2 : Int) return Int is
       Result : IntRep := 1;
    begin
-      for J in 1 .. IntRep (I2) loop
+      for J in 1 .. IntRep (I2) loop  -- STOP "**"
          Result := IntRep (I1) * Result;
       end loop;
       return Int (Result);
@@ -61,57 +61,57 @@ package body Ops is
 
    function "<" (I1, I2 : Int) return Boolean is
    begin
-      return IntRep (I1) < IntRep (I2);
+      return IntRep (I1) < IntRep (I2);  -- STOP "<"
    end;
 
    function "<=" (I1, I2 : Int) return Boolean is
    begin
-      return IntRep (I1) <= IntRep (I2);
+      return IntRep (I1) <= IntRep (I2);  -- STOP "<="
    end;
 
    function ">" (I1, I2 : Int) return Boolean is
    begin
-      return IntRep (I1) > IntRep (I2);
+      return IntRep (I1) > IntRep (I2);  -- STOP ">"
    end;
 
    function ">=" (I1, I2 : Int) return Boolean is
    begin
-      return IntRep (I1) >= IntRep (I2);
+      return IntRep (I1) >= IntRep (I2);  -- STOP ">="
    end;
 
    function "=" (I1, I2 : Int) return Boolean is
    begin
-      return IntRep (I1) = IntRep (I2);
+      return IntRep (I1) = IntRep (I2);  -- STOP "="
    end;
 
    function "and" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) and IntRep (I2));
+      return Int (IntRep (I1) and IntRep (I2));  -- STOP "and"
    end;
 
    function "or" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) or IntRep (I2));
+      return Int (IntRep (I1) or IntRep (I2));  -- STOP "or"
    end;
 
    function "xor" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) xor IntRep (I2));
+      return Int (IntRep (I1) xor IntRep (I2));  -- STOP "xor"
    end;
 
    function "&" (I1, I2 : Int) return Int is
    begin
-      return Int (IntRep (I1) and IntRep (I2));
+      return Int (IntRep (I1) and IntRep (I2));  -- STOP "&"
    end;
 
    function "abs" (I1 : Int) return Int is
    begin
-      return Int (abs IntRep (I1));
+      return Int (abs IntRep (I1));  -- STOP "abs"
    end;
 
    function "not" (I1 : Int) return Int is
    begin
-      return Int (not IntRep (I1));
+      return Int (not IntRep (I1));  -- STOP "not"
    end;
 
    function "+" (I1 : Int) return Int is
-- 
1.7.1


  reply	other threads:[~2012-03-27 15:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 23:18 Keith Seitz
2012-03-27  1:45 ` asmwarrior
2012-03-28 18:55   ` Tom Tromey
2012-03-27 13:56 ` Joel Brobecker
2012-03-27 14:31   ` Keith Seitz
2012-03-27 14:54     ` Joel Brobecker
2012-03-27 15:05       ` Joel Brobecker [this message]
2012-03-27 18:08         ` Keith Seitz
2012-03-28 20:46 ` Tom Tromey
2012-03-29 19:18   ` Keith Seitz
2012-03-30 15:34     ` Tom Tromey
2012-03-30 15:59       ` Keith Seitz
2012-03-30 16:37         ` Tom Tromey
2012-03-30 17:09           ` Joel Brobecker
2012-03-30 17:56             ` Tom Tromey
2012-03-30 18:05               ` Keith Seitz
2012-04-03 23:22                 ` Keith Seitz
2012-04-05 15:22                   ` Tom Tromey
2012-04-05 15:55                     ` Doug Evans
2012-04-05 19:01                       ` Keith Seitz
2012-07-22 19:33                   ` Andreas Schwab
2012-07-23 17:57                     ` Keith Seitz
2012-07-23 18:55                       ` Tom Tromey
2012-07-23 21:13                         ` Keith Seitz
2012-04-03 21:19 ` Doug Evans
2012-04-03 23:14   ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120327150528.GE2701@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox