From e20f36ceed0a0d183048913e5cc630db6f753989 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 7 Apr 2010 20:34:04 +0000 Subject: [PATCH] - Fix gstack to print even the frame #0. New gdb.base/gstack.exp. (BZ 579793) --- gdb-6.3-gstack-20050411.patch | 122 +++++++++++++++++++++++++++++++++- gdb.spec | 5 +- 2 files changed, 125 insertions(+), 2 deletions(-) diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index ceb27bf..e38ddd3 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -111,6 +111,126 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh +$backtrace +EOF +/bin/sed -n \ -+ -e 's/^(gdb) //' \ ++ -e 's/^\((gdb) \)*//' \ + -e '/^#/p' \ + -e '/^Thread/p' +--- /dev/null 2010-04-07 06:20:52.289994508 +0200 ++++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.exp 2010-04-07 21:53:57.000000000 +0200 +@@ -0,0 +1,71 @@ ++# Copyright (C) 2010 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 . ++ ++set testfile gstack ++set executable ${testfile} ++set binfile ${objdir}/${subdir}/$executable ++if {[build_executable ${testfile} ${executable} "" {debug}] == -1} { ++ return -1 ++} ++ ++set test "spawn inferior" ++set command "${binfile}" ++set res [remote_spawn host $command]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $command failed." ++ fail $test ++ return ++} ++set pid [exp_pid -i $res] ++gdb_expect { ++ -re "looping\r\n" { ++ pass $test ++ } ++ eof { ++ fail "$test (eof)" ++ return ++ } ++ timeout { ++ fail "$test (timeout)" ++ return ++ } ++} ++gdb_exit ++ ++# Testcase uses the most simple notification not to get caught by attach on ++# exiting the function. Still we could retry the gstack command if we fail. ++ ++set test "spawn gstack" ++set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END" ++set res [remote_spawn host $command]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $command failed." ++ fail $test ++} ++set pid [exp_pid -i $res] ++gdb_expect { ++ -re {^#0 +0x[0-9a-f]+ in func \(\)\r\n#1 +0x[0-9a-f]+ in main \(\)\r\nGSTACK-END\r\n$} { ++ pass $test ++ } ++ eof { ++ fail "$test (eof)" ++ } ++ timeout { ++ fail "$test (timeout)" ++ } ++} ++gdb_exit ++ ++remote_exec host "kill -9 $pid" +--- /dev/null 2010-04-07 06:20:52.289994508 +0200 ++++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.c 2010-04-07 21:46:52.000000000 +0200 +@@ -0,0 +1,43 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007, 2008, 2009 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 . */ ++ ++#include ++#include ++#include ++ ++void ++func (void) ++{ ++ const char msg[] = "looping\n"; ++ ++ /* Use the most simple notification not to get caught by attach on exiting ++ the function. */ ++ write (1, msg, strlen (msg)); ++ ++ for (;;); ++} ++ ++int ++main (void) ++{ ++ alarm (60); ++ nice (100); ++ ++ func (); ++ ++ return 0; ++} diff --git a/gdb.spec b/gdb.spec index f1c88f6..48a6ac0 100644 --- a/gdb.spec +++ b/gdb.spec @@ -36,7 +36,7 @@ Version: 7.0.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 42%{?_with_upstream:.upstream}%{dist} +Release: 43%{?_with_upstream:.upstream}%{dist} License: GPLv3+ Group: Development/Debuggers @@ -1084,6 +1084,9 @@ fi %endif %changelog +* Wed Apr 7 2010 Jan Kratochvil - 7.0.1-43.fc12 +- Fix gstack to print even the frame #0. New gdb.base/gstack.exp. (BZ 579793) + * Wed Apr 7 2010 Jan Kratochvil - 7.0.1-42.fc12 - Merge gdb-6.3-gstack-without-path-20060414.p* into gdb-6.3-gstack-20050411.p*, no real code change.