public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: Testcase for: Load strictly build-id-checked core files only if no executable
Date: Sat, 27 Jun 2026 23:57:42 GMT	[thread overview]
Message-ID: <178260466273.1.12859337255504485855.rpms-gdb-5c5eb100c430@fedoraproject.org> (raw)

          A new commit has been pushed.

          Repo   : rpms/gdb
          Branch : gdb-17.2-rebase-f44
          Commit : 5c5eb100c430cdd77130335efdf21d8f2fb3f22e
          Author : Jan Kratochvil <jan.kratochvil@redhat.com>
          Date   : 2016-07-31T23:28:07+02:00
          Stats  : +170/-1 in 2 file(s)
          URL    : https://src.fedoraproject.org/rpms/gdb/c/5c5eb100c430cdd77130335efdf21d8f2fb3f22e?branch=gdb-17.2-rebase-f44

          Log:
          Testcase for: Load strictly build-id-checked core files only if no executable

is specified (Jan Kratochvil, RH BZ 1339862).

---
diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch
index a89893c..f4dccc9 100644
--- a/gdb-6.6-buildid-locate-solib-missing-ids.patch
+++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch
@@ -1,3 +1,6 @@
+gdb returns an incorrect back trace when applying a debuginfo
+https://bugzilla.redhat.com/show_bug.cgi?id=1339862
+
 Index: gdb-7.9.90.20150709/gdb/solib-svr4.c
 ===================================================================
 --- gdb-7.9.90.20150709.orig/gdb/solib-svr4.c	2015-07-09 18:18:54.526417766 +0200
@@ -57,3 +60,163 @@ Index: gdb-7.9.90.20150709/gdb/solib-svr4.c
  
  	    xfree (build_id_filename);
  	    xfree (build_id);
+--- /dev/null	2016-07-02 20:29:01.679404943 +0200
++++ gdb-7.11.50.20160721/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp	2016-07-31 23:04:49.062753722 +0200
+@@ -0,0 +1,105 @@
++# Copyright 2016 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 <http://www.gnu.org/licenses/>.
++
++if {[skip_shlib_tests]} {
++    return 0
++}
++
++set testfile "gcore-buildid-exec-but-not-solib"
++set srcmainfile ${testfile}-main.c
++set srclibfile ${testfile}-lib.c
++set libfile [standard_output_file ${testfile}-lib.so]
++set objfile [standard_output_file ${testfile}-main.o]
++set executable ${testfile}-main
++set binfile [standard_output_file ${executable}]
++set gcorefile [standard_output_file ${executable}.gcore]
++set outdir [file dirname $binfile]
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != ""
++     || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
++     unsupported "-Wl,--build-id compilation failed"
++     return -1
++}
++set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"]
++if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
++     unsupported "-Wl,--build-id compilation failed"
++     return -1
++}
++
++clean_restart $executable
++gdb_load_shlib $libfile
++
++# Does this gdb support gcore?
++set test "help gcore"
++gdb_test_multiple $test $test {
++    -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
++	# gcore command not supported -- nothing to test here.
++	unsupported "gdb does not support gcore on this target"
++	return -1;
++    }
++    -re "Save a core file .*\r\n$gdb_prompt $" {
++	pass $test
++    }
++}
++
++if { ![runto lib] } then {
++    return -1
++}
++
++set escapedfilename [string_to_regexp ${gcorefile}]
++
++set test "save a corefile"
++gdb_test_multiple "gcore ${gcorefile}" $test {
++    -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
++	pass $test
++    }
++    -re "Can't create a corefile\r\n$gdb_prompt $" {
++	unsupported $test
++	return -1
++    }
++}
++
++# Now restart gdb and load the corefile.
++
++clean_restart $executable
++gdb_load_shlib $libfile
++
++set buildid [build_id_debug_filename_get $libfile]
++
++regsub {\.debug$} $buildid {} buildid
++
++set debugdir [standard_output_file ${testfile}-debugdir]
++file delete -force -- $debugdir
++
++file mkdir $debugdir/[file dirname $libfile]
++file copy $libfile $debugdir/${libfile}
++
++file mkdir $debugdir/[file dirname $buildid]
++file copy $libfile $debugdir/${buildid}
++
++remote_exec build "ln -s /lib       ${debugdir}/"
++remote_exec build "ln -s /lib64     ${debugdir}/"
++# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2
++
++gdb_test "set solib-absolute-prefix $debugdir"
++
++gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory"
++
++gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
++
++gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
++
++gdb_test "bt"
++gdb_test "info shared"
+--- /dev/null	2016-07-02 20:29:01.679404943 +0200
++++ gdb-7.11.50.20160721/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c	2016-07-28 21:06:40.977786922 +0200
+@@ -0,0 +1,25 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++   This file is part of GDB.
++
++   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 <http://www.gnu.org/licenses/>.  */
++
++extern void lib (void);
++
++int
++main (void)
++{
++  lib ();
++  return 0;
++}
+--- /dev/null	2016-07-02 20:29:01.679404943 +0200
++++ gdb-7.11.50.20160721/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c	2016-07-28 21:06:40.977786922 +0200
+@@ -0,0 +1,21 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++   This file is part of GDB.
++
++   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 <http://www.gnu.org/licenses/>.  */
++
++void
++lib (void)
++{
++}

diff --git a/gdb.spec b/gdb.spec
index da67e0b..03f60e2 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -27,7 +27,7 @@ Version: 7.11.50.%{snapsrc}
 
 # 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: 3%{?dist}
+Release: 4%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
 Group: Development/Debuggers
@@ -275,6 +275,8 @@ Patch271: gdb-6.5-bz243845-stale-testing-zombie-test.patch
 #=push
 Patch274: gdb-6.6-buildid-locate.patch
 # Fix loading of core files without build-ids but with build-ids in executables.
+# Load strictly build-id-checked core files only if no executable is specified
+# (Jan Kratochvil, RH BZ 1339862).
 #=push
 Patch659: gdb-6.6-buildid-locate-solib-missing-ids.patch
 #=push
@@ -1422,6 +1424,10 @@ then
 fi
 
 %changelog
+* Sun Jul 31 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.11.50.20160721-4.fc25
+- Testcase for: Load strictly build-id-checked core files only if no executable
+  is specified (Jan Kratochvil, RH BZ 1339862).
+
 * Thu Jul 28 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.11.50.20160721-3.fc25
 - Do not apply RHEL-6 patches on non-RHEL-6 even for testsuite.
 

                 reply	other threads:[~2026-06-27 23:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=178260466273.1.12859337255504485855.rpms-gdb-5c5eb100c430@fedoraproject.org \
    --to=jan.kratochvil@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /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