From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6159 invoked by alias); 14 Nov 2007 02:38:36 -0000 Received: (qmail 6125 invoked by uid 440); 14 Nov 2007 02:38:31 -0000 Date: Wed, 14 Nov 2007 02:38:00 -0000 Message-ID: <20071114023831.6109.qmail@sourceware.org> From: scox@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Merge branch 'master' of ssh://sources.redhat.com/git/frysk X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 9198be3c3245c0e8a8ab7cd054e99306d1a51250 X-Git-Newrev: 7b8e7ff2a2900c7837e1fee0de204f049fa01e58 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2007-q4/txt/msg00358.txt.bz2 The branch, master has been updated via 7b8e7ff2a2900c7837e1fee0de204f049fa01e58 (commit) via 208d3e75e13ae1fbf8f8c24b222e34a2ef5054fb (commit) from 9198be3c3245c0e8a8ab7cd054e99306d1a51250 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 7b8e7ff2a2900c7837e1fee0de204f049fa01e58 Merge: 208d3e75e13ae1fbf8f8c24b222e34a2ef5054fb 9198be3c3245c0e8a8ab7cd054e99306d1a51250 Author: Stan Cox Date: Tue Nov 13 21:36:31 2007 -0500 Merge branch 'master' of ssh://sources.redhat.com/git/frysk commit 208d3e75e13ae1fbf8f8c24b222e34a2ef5054fb Author: Stan Cox Date: Tue Nov 13 21:04:02 2007 -0500 Add tests for hpd list request. * ListCommand.java (interpret): Check that symbol is a subprogram. Fix reversing. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/hpd/ChangeLog | 5 + frysk-core/frysk/hpd/ListCommand.java | 22 ++++-- frysk-core/frysk/hpd/TestListCommand.java | 129 +++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 7 deletions(-) create mode 100644 frysk-core/frysk/hpd/TestListCommand.java First 500 lines of diff: diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog index 6115ec8..3905c2e 100644 --- a/frysk-core/frysk/hpd/ChangeLog +++ b/frysk-core/frysk/hpd/ChangeLog @@ -1,3 +1,8 @@ +2007-11-13 Stan Cox + + * ListCommand.java (interpret): Check that symbol is a subprogram. + Fix reversing. + 2007-11-13 Andrew Cagney * Input.java (getAction): Delete. diff --git a/frysk-core/frysk/hpd/ListCommand.java b/frysk-core/frysk/hpd/ListCommand.java index c4f3cc4..81dbd74 100644 --- a/frysk-core/frysk/hpd/ListCommand.java +++ b/frysk-core/frysk/hpd/ListCommand.java @@ -46,6 +46,7 @@ import java.io.IOException; import java.io.LineNumberReader; import java.util.Iterator; import lib.dwfl.DwarfDie; +import lib.dwfl.DwTag; import frysk.debuginfo.DebugInfoFrame; import frysk.debuginfo.DebugInfo; import frysk.proc.Task; @@ -80,6 +81,7 @@ class ListCommand extends ParameterizedCommand { private File file = null; private int line; private int exec_line = 0; + void interpret(CLI cli, Input cmd, Object o) { Options options = (Options)o; PTSet ptset = cli.getCommandPTSet(cmd); @@ -113,18 +115,24 @@ class ListCommand extends ParameterizedCommand { funcDie = debugInfo .getSymbolDie(cmd.parameter(0)); } - line = (int)funcDie.getDeclLine(); + if (funcDie.getTag().hashCode() == DwTag.SUBPROGRAM_) { + line = (int)funcDie.getDeclLine(); + file = new File(funcDie.getDeclFile()); + } + else { + cli.addMessage("function " + cmd.parameter(0) + " not found.", + Message.TYPE_ERROR); + return; + } } } } else if (options.length != null) { windowSize = options.length.magnitude; - if (options.length.sign < 0) - line -= windowSize; - else if (options.length.sign > 0) + if (options.length.sign < 0) { + windowSize *= -1; line += windowSize; - else - line -= windowSize / 2; + } } else if (frame.getLines()[0].getLine() != exec_line) { // list around pc. @@ -192,7 +200,7 @@ class ListCommand extends ParameterizedCommand { cli.addMessage("file " + file + " not found.", Message.TYPE_ERROR); } - } + } } diff --git a/frysk-core/frysk/hpd/TestListCommand.java b/frysk-core/frysk/hpd/TestListCommand.java new file mode 100644 index 0000000..48c6144 --- /dev/null +++ b/frysk-core/frysk/hpd/TestListCommand.java @@ -0,0 +1,129 @@ +// This file is part of the program FRYSK. +// +// Copyright 2007 Red Hat Inc. +// +// FRYSK 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; version 2 of the License. +// +// FRYSK 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 FRYSK; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// In addition, as a special exception, Red Hat, Inc. gives You the +// additional right to link the code of FRYSK with code not covered +// under the GNU General Public License ("Non-GPL Code") and to +// distribute linked combinations including the two, subject to the +// limitations in this paragraph. Non-GPL Code permitted under this +// exception must only link to the code of FRYSK through those well +// defined interfaces identified in the file named EXCEPTION found in +// the source code files (the "Approved Interfaces"). The files of +// Non-GPL Code may instantiate templates or use macros or inline +// functions from the Approved Interfaces without causing the +// resulting work to be covered by the GNU General Public +// License. Only Red Hat, Inc. may make changes or additions to the +// list of Approved Interfaces. You must obey the GNU General Public +// License in all respects for all of the FRYSK code and other code +// used in conjunction with FRYSK except the Non-GPL Code covered by +// this exception. If you modify this file, you may extend this +// exception to your version of the file, but you are not obligated to +// do so. If you do not wish to provide this exception without +// modification, you must delete this exception statement from your +// version and license this file solely under the GPL without +// exception. + +package frysk.hpd; + + +/** + * Test the functionality of the alias and unalias commands. + */ + +public class TestListCommand extends TestLib { + public void setUp() { + super.setUp(); + e = new HpdTestbed(); + } + + public void testListPC() { + e = HpdTestbed.run("hpd-c"); + e.send("break main\n"); + e.expect("breakpoint.*" + prompt); + e.send("go\n"); + e.expect("go.*\n" + prompt + "Breakpoint"); + e.send("list\n"); + e.expect(".*208.*int.*209.*int.*210.*int_21.*211.*int_21.*215.*int.*" + + "216.*main.*\\*.*218.*if.*219.*fprintf" + + ".*221.*int.*222.*int.*.*223.*return.*224.*"); + e.send("quit\n"); + e.expect("quit.*\nQuitting..."); + e.close(); + } + + public void testListFunction() { + e = HpdTestbed.run("hpd-c"); + e.send("break main\n"); + e.expect("breakpoint.*" + prompt); + e.send("go\n"); + e.expect("go.*\n" + prompt + "Breakpoint"); + e.send("list\n"); + e.expect(prompt); + e.send("list func_2\n"); + e.expect( + ".*158.*159.*typedef.*160.*static_class_t.*161.*enum.*" + + "162.*static_class_t.*163.*struct.*164.*asm.*165.*struct.*" + + "166.*asm.*167.*struct.*168.*struct.*169.*typedef.*" + + "170.*volatile.*171.*long.*172.*int.*173.*float.*174.*char.*" + + "175.*static_class_t.*176.*volatile.*177.*sportscar.*" + + prompt); + e.send("list -length 10\n"); + e.expect( + ".*178.*char.*179.*short.*180.*int.*181.*long.*182.*float.*" + + "183.*double.*184.*assign_long_arr.*185.*assign_int_arr.*"); + e.send("quit\n"); + e.expect("quit.*\nQuitting..."); + e.close(); + } + + public void testListReverse() { + e = HpdTestbed.run("hpd-c"); + e.send("break main\n"); + e.expect("breakpoint.*" + prompt); + e.send("go\n"); + e.expect("go.*\n" + prompt + "Breakpoint"); + e.send("list\n"); + e.expect(prompt); + e.send("list -length -10\n"); + e.expect(".*198.*while.*202.*return.*205.*static.*206.*func_1.*207"); + e.send("list -length -10\n"); + e.expect(".*188.*sportscar.*190.*int_p.*191.*class_p.*192.*class_p.*" + + "193.*class_p.*194.*class_1.*196.*int_21.*197.*"); + e.send("quit\n"); + e.expect("quit.*\nQuitting..."); + e.close(); + } + + public void testListErrors() { + e = HpdTestbed.run("hpd-c"); + e.send("break main\n"); + e.expect("breakpoint.*" + prompt); + e.send("go\n"); + e.expect("go.*\n" + prompt + "Breakpoint"); + e.send("list x\n"); + e.expect(".*function x not found.*" + prompt); + e.send("list xyz\n"); + e.expect(".*symbol xyz not found.*" + prompt); + e.send("quit\n"); + e.expect("quit.*\nQuitting..."); + e.close(); + } +} + + + + hooks/post-receive -- frysk system monitor/debugger