From c48fd2d065cddafba771c6bead7ee16806505089 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 13 Dec 2017 03:53:13 -0500 Subject: [PATCH] WIP: `nsym != NULL' assert failure in stack.c::print_frame_args --- gdb/stack.c | 6 +++- gdb/testsuite/gdb.ada/access_tagged_param.exp | 37 +++++++++++++++++++++++ gdb/testsuite/gdb.ada/access_tagged_param/foo.adb | 20 ++++++++++++ gdb/testsuite/gdb.ada/access_tagged_param/pck.adb | 21 +++++++++++++ gdb/testsuite/gdb.ada/access_tagged_param/pck.ads | 21 +++++++++++++ 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.ada/access_tagged_param.exp create mode 100644 gdb/testsuite/gdb.ada/access_tagged_param/foo.adb create mode 100644 gdb/testsuite/gdb.ada/access_tagged_param/pck.adb create mode 100644 gdb/testsuite/gdb.ada/access_tagged_param/pck.ads diff --git a/gdb/stack.c b/gdb/stack.c index 6bd0d45..521cef1 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -615,8 +615,12 @@ print_frame_args (struct symbol *func, struct frame_info *frame, if (*SYMBOL_LINKAGE_NAME (sym)) { struct symbol *nsym; + std::string sym_linkage_name (SYMBOL_LINKAGE_NAME (sym)); - nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), + if (SYMBOL_LANGUAGE (sym) == language_ada) + sym_linkage_name = std::string("<") + sym_linkage_name + '>'; + + nsym = lookup_symbol (sym_linkage_name.c_str (), b, VAR_DOMAIN, NULL).symbol; gdb_assert (nsym != NULL); if (SYMBOL_CLASS (nsym) == LOC_REGISTER diff --git a/gdb/testsuite/gdb.ada/access_tagged_param.exp b/gdb/testsuite/gdb.ada/access_tagged_param.exp new file mode 100644 index 0000000..a5e399f --- /dev/null +++ b/gdb/testsuite/gdb.ada/access_tagged_param.exp @@ -0,0 +1,37 @@ +# Copyright 2017 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 . + +load_lib "ada.exp" + +standard_ada_testfile foo + +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } { + return -1 +} + +clean_restart ${testfile} + +if ![runto "foo"] then { + perror "Couldn't run ${testfile}" + return +} + +gdb_breakpoint "pck.inspect" + +# Continue until we reach the breakpoint, and verify that we can print +# the value of all the parameters. + +gdb_test "continue" \ + ".*Breakpoint $decimal, pck\\.inspect \\(obj=$hex, =2\\) at .*" diff --git a/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb b/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb new file mode 100644 index 0000000..bd7e641 --- /dev/null +++ b/gdb/testsuite/gdb.ada/access_tagged_param/foo.adb @@ -0,0 +1,20 @@ +-- Copyright 2017 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 . + +with Pck; use Pck; +procedure Foo is +begin + Inspect (new Top_T'(N => 2)); +end Foo; diff --git a/gdb/testsuite/gdb.ada/access_tagged_param/pck.adb b/gdb/testsuite/gdb.ada/access_tagged_param/pck.adb new file mode 100644 index 0000000..88fa970 --- /dev/null +++ b/gdb/testsuite/gdb.ada/access_tagged_param/pck.adb @@ -0,0 +1,21 @@ +-- Copyright 2017 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 . + +package body Pck is + procedure Inspect (Obj: access Top_T'Class) is + begin + null; + end Inspect; +end Pck; diff --git a/gdb/testsuite/gdb.ada/access_tagged_param/pck.ads b/gdb/testsuite/gdb.ada/access_tagged_param/pck.ads new file mode 100644 index 0000000..bbb5c8d --- /dev/null +++ b/gdb/testsuite/gdb.ada/access_tagged_param/pck.ads @@ -0,0 +1,21 @@ +-- Copyright 2017 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 . + +package Pck is + type Top_T is tagged record + N : Integer := 1; + end record; + procedure Inspect (Obj: access Top_T'Class); +end Pck; -- 2.1.4