commit
fbca56f17a
@ -105,4 +105,3 @@ new file mode 100644
|
||||
+# work.
|
||||
+
|
||||
+remote_exec build "kill -9 ${testpid}"
|
||||
|
||||
|
||||
@ -310,4 +310,3 @@ diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arc
|
||||
verbose "Skipping PowerPC prologue tests."
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -99,4 +95,3 @@ new file mode 100644
|
||||
+ pass "Program exited"
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
@ -43,4 +43,3 @@ new file mode 100644
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
@ -1,13 +1,7 @@
|
||||
2004-11-23 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* Makefile.in (uninstall-gstack, install-gstack): New rules, add
|
||||
to install and uninstall.
|
||||
* gstack.sh, gstack.1: New files.
|
||||
|
||||
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
--- a/gdb/Makefile.in
|
||||
+++ b/gdb/Makefile.in
|
||||
@@ -1749,7 +1749,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
||||
@@ -1768,7 +1768,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
||||
install: all
|
||||
@$(MAKE) $(FLAGS_TO_PASS) install-only
|
||||
|
||||
@ -16,7 +10,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e "$$t"` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -1798,7 +1798,25 @@ install-guile:
|
||||
@@ -1817,7 +1817,25 @@ install-guile:
|
||||
install-python:
|
||||
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
||||
|
||||
@ -43,7 +37,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e $$t` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -1821,6 +1839,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
@@ -1840,6 +1858,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
fi
|
||||
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
@ -247,4 +241,3 @@ new file mode 100644
|
||||
+
|
||||
+# Kill the test inferior.
|
||||
+kill_wait_spawned_process $test_spawn_id
|
||||
|
||||
|
||||
@ -1,14 +1,3 @@
|
||||
2005-07-21 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* gdb.base/attach-32.exp: New test for attaching in 32-bit
|
||||
mode on 64-bit systems.
|
||||
* gdb.base/attach-32.c: Ditto.
|
||||
* gdb.base/attach-32b.c: Ditto.
|
||||
|
||||
2007-12-26 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -254,7 +243,7 @@ new file mode 100644
|
||||
+}
|
||||
+
|
||||
+set GDBFLAGS_orig $GDBFLAGS
|
||||
+set GDBFLAGS "--pid=$testpid"
|
||||
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
|
||||
+gdb_start
|
||||
+set GDBFLAGS $GDBFLAGS_orig
|
||||
+
|
||||
@ -276,7 +265,7 @@ new file mode 100644
|
||||
+}
|
||||
+
|
||||
+set GDBFLAGS_orig $GDBFLAGS
|
||||
+set GDBFLAGS "--pid=$testpid"
|
||||
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
|
||||
+gdb_start
|
||||
+set GDBFLAGS $GDBFLAGS_orig
|
||||
+
|
||||
@ -313,4 +302,3 @@ new file mode 100644
|
||||
+ }
|
||||
+ return (0);
|
||||
+}
|
||||
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
2005-07-26 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* gdb.cp/b146835.exp: New testcase.
|
||||
* gdb.cp/b146835.cc: Ditto.
|
||||
* gdb.cp/b146835b.cc: Ditto.
|
||||
* gdb.cp/b146835.h: Ditto.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -151,4 +144,3 @@ new file mode 100644
|
||||
+void A::funcD (class E *e, class D *d) {}
|
||||
+void A::funcE (E *e, D *d) {}
|
||||
+void A::funcF (unsigned long x, D *d) {}
|
||||
|
||||
|
||||
@ -237,4 +237,3 @@ new file mode 100644
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
@ -237,4 +237,3 @@ new file mode 100644
|
||||
+}
|
||||
+
|
||||
+gdb_continue_to_breakpoint "First line ~C"
|
||||
|
||||
|
||||
@ -1,9 +1,3 @@
|
||||
i2005-01-25 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* gdb.base/move-dir.exp: New test.
|
||||
* gdb.base/move-dir.c: Ditto.
|
||||
* gdb.base/move-dir.h: Ditto.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -93,4 +87,3 @@ new file mode 100644
|
||||
+ printf ("%s\n", ostring);;
|
||||
+}
|
||||
+
|
||||
|
||||
|
||||
@ -2017,4 +2017,3 @@ new file mode 100644
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
|
||||
|
||||
@ -1,11 +1,3 @@
|
||||
2004-02-23 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* gdb.gdb/selftest.exp: Make sure that the debug directory is
|
||||
set up properly.
|
||||
* gdb.gdb/complaints.exp: Ditto.
|
||||
* gdb.gdb/xfullpath.exp: Ditto.
|
||||
* gdb.gdb/observer.exp: Ditto.
|
||||
|
||||
diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
|
||||
--- a/gdb/testsuite/lib/selftest-support.exp
|
||||
+++ b/gdb/testsuite/lib/selftest-support.exp
|
||||
@ -32,4 +24,3 @@ diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest
|
||||
|
||||
if {$result < 0} then {
|
||||
warning "Couldn't test self"
|
||||
|
||||
|
||||
@ -1,47 +1,3 @@
|
||||
2005-02-28 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* config/i386/nm-linux.h: Change dr register routines to
|
||||
accept a ptid_t first argument. Change all calling macros
|
||||
to default the inferior_ptid for the first argument.
|
||||
(i386_linux_insert_watchpoint): New prototype.
|
||||
(i386_linux_remove_watchpoint, i386_linux_insert_hw_breakpoint): Ditto.
|
||||
(i386_linux_remove_hw_breakpoint): Ditto.
|
||||
(target_insert_watchpoint, target_remove_watchpoint): Undef and
|
||||
override.
|
||||
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Ditto.
|
||||
* config/i386/nm-linux64.h: Ditto except add amd64 versions of
|
||||
the watchpoint/hw-breakpoint insert/remove routines.
|
||||
* i386-nat.c: Include "inferior.h" to define inferior_ptid.
|
||||
* i386-linux-nat.c: Change all dr get/set routines to accept
|
||||
ptid_t as first argument and to use this argument to determine
|
||||
the tid for PTRACE.
|
||||
(i386_linux_set_debug_regs_for_thread): New function.
|
||||
(i386_linux_sync_debug_registers_callback): Ditto.
|
||||
(i386_linux_sync_debug_registers_across_threads): Ditto.
|
||||
(i386_linux_insert_watchpoint, i386_linux_remove_watchpoint): Ditto.
|
||||
(i386_linux_hw_breakpoint, i386_linux_remove_hw_breakpoint): Ditto.
|
||||
(i386_linux_new_thread): Ditto.
|
||||
(_initialize_i386_linux_nat): Ditto.
|
||||
* amd64-linux-nat.c: Change all dr get/set routines to accept
|
||||
ptid_t as first argument and to use this argument to determine
|
||||
the tid for PTRACE.
|
||||
(amd64_linux_set_debug_regs_for_thread): New function.
|
||||
(amd64_linux_sync_debug_registers_callback): Ditto.
|
||||
(amd64_linux_sync_debug_registers_across_threads): Ditto.
|
||||
(amd64_linux_insert_watchpoint, amd64_linux_remove_watchpoint): Ditto.
|
||||
(amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto.
|
||||
(amd64_linux_new_thread): Ditto.
|
||||
(_initialize_amd64_linux_nat): Register linux new thread observer.
|
||||
* testsuite/gdb.threads/watchthreads-threaded.c: New test case.
|
||||
* testsuite/gdb.threads/watchthreads-threaded.exp: Ditto.
|
||||
|
||||
[ With recent upstream GDB (6.8) reduced only to the testcase. ]
|
||||
|
||||
[ It was called watchthreads2.{exp,c} before but it conflicted with FSF GDB new
|
||||
testcase of the same name. ]
|
||||
|
||||
FIXME: The testcase does not expects multiple watchpoints hits per one stop.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -244,4 +200,3 @@ new file mode 100644
|
||||
+} else {
|
||||
+ fail $message
|
||||
+}
|
||||
|
||||
|
||||
@ -928,4 +928,3 @@ new file mode 100644
|
||||
+rm -rf $WORKDIR
|
||||
+
|
||||
+exit $FAILURES
|
||||
|
||||
|
||||
@ -1,21 +1,3 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921
|
||||
|
||||
It is duplicite to its upstream variant:
|
||||
http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html
|
||||
http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html
|
||||
2007-01-21 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb.base/included.c, gdb.base/included.exp,
|
||||
gdb.base/included.h: New files.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c,
|
||||
gdb.dwarf2/dw2-included.h: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -124,4 +106,3 @@ new file mode 100644
|
||||
+ USA. */
|
||||
+
|
||||
+int integer;
|
||||
|
||||
|
||||
@ -1,44 +1,9 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337
|
||||
|
||||
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.8pre.
|
||||
|
||||
currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you
|
||||
will get:
|
||||
(gdb) p errno
|
||||
[some error]
|
||||
|
||||
* with -ggdb2 and less "errno" in fact does not exist anywhere as it was
|
||||
compiled to "(*__errno_location ())" and the macro definition is not present.
|
||||
Unfortunately gdb will find the TLS symbol and it will try to access it but
|
||||
as the program has been compiled without -lpthread the TLS base register
|
||||
(%gs on i386) is not setup and it will result in:
|
||||
Cannot access memory at address 0x8
|
||||
|
||||
Attached suggestion patch how to deal with the most common "errno" symbol
|
||||
for the most common under-ggdb3 compiled programs.
|
||||
|
||||
Original patch hooked into target_translate_tls_address. But its inferior
|
||||
call invalidates `struct frame *' in the callers - RH BZ 690908.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1166549
|
||||
|
||||
2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer
|
||||
DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C.
|
||||
|
||||
glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
|
||||
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
|
||||
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
|
||||
|
||||
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
|
||||
--- a/gdb/printcmd.c
|
||||
+++ b/gdb/printcmd.c
|
||||
@@ -1183,6 +1183,10 @@ print_command_1 (const char *exp, int voidprint)
|
||||
@@ -1214,6 +1214,10 @@ print_command_1 (const char *args, int voidprint)
|
||||
|
||||
if (exp && *exp)
|
||||
if (exp != nullptr && *exp)
|
||||
{
|
||||
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
|
||||
+ function descriptors. */
|
||||
@ -254,4 +219,3 @@ new file mode 100644
|
||||
+
|
||||
+# TODO: Test the error on resolving ERRNO with only libc loaded.
|
||||
+# Just how to find the current libc filename?
|
||||
|
||||
|
||||
@ -1,297 +0,0 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711
|
||||
|
||||
FIXME: This workaround should be dropped and
|
||||
glibc/sysdeps/unix/sysv/linux/x86_64/clone.S should get CFI for the child
|
||||
instead.
|
||||
|
||||
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb/amd64-linux-tdep.c (linux_clone_code): New variable.
|
||||
(LINUX_CLONE_LEN): New definition.
|
||||
(amd64_linux_clone_running, amd64_linux_outermost_frame): New function.
|
||||
(amd64_linux_init_abi): Initialize `outermost_frame_p'.
|
||||
* gdb/i386-tdep.c (i386_gdbarch_init): Likewise.
|
||||
* gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member.
|
||||
* gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'.
|
||||
|
||||
2006-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c:
|
||||
New file.
|
||||
|
||||
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.7.
|
||||
|
||||
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
|
||||
--- a/gdb/amd64-linux-tdep.c
|
||||
+++ b/gdb/amd64-linux-tdep.c
|
||||
@@ -291,6 +291,80 @@ amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||
|
||||
/* Set the program counter for process PTID to PC. */
|
||||
|
||||
+/* Detect the outermost frame; during unwind of
|
||||
+ #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6
|
||||
+ avoid the additional bogus frame
|
||||
+ #6 0x0000000000000000 in ??
|
||||
+ We compare if the `linux_clone_code' block is _before_ unwound PC. */
|
||||
+
|
||||
+static const unsigned char linux_clone_code[] =
|
||||
+{
|
||||
+/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */
|
||||
+/* #ifdef RESET_PID */
|
||||
+/* ... */
|
||||
+/* mov $SYS_ify(getpid), %eax */
|
||||
+/* 0xb8, 0x27, 0x00, 0x00, 0x00 */
|
||||
+/* OR */
|
||||
+/* mov $SYS_ify(getpid), %rax */
|
||||
+/* 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00 */
|
||||
+/* so just: */
|
||||
+ 0x27, 0x00, 0x00, 0x00,
|
||||
+/* syscall */
|
||||
+ 0x0f, 0x05,
|
||||
+/* movl %eax, %fs:PID */
|
||||
+ 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00,
|
||||
+/* movl %eax, %fs:TID */
|
||||
+ 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00,
|
||||
+/* #endif */
|
||||
+/* |* Set up arguments for the function call. *| */
|
||||
+/* popq %rax |* Function to call. *| */
|
||||
+ 0x58,
|
||||
+/* popq %rdi |* Argument. *| */
|
||||
+ 0x5f,
|
||||
+/* call *%rax$ */
|
||||
+ 0xff, 0xd0
|
||||
+};
|
||||
+
|
||||
+#define LINUX_CLONE_LEN (sizeof linux_clone_code)
|
||||
+
|
||||
+static int
|
||||
+amd64_linux_clone_running (struct frame_info *this_frame)
|
||||
+{
|
||||
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
||||
+ unsigned char buf[LINUX_CLONE_LEN];
|
||||
+
|
||||
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_LEN, buf,
|
||||
+ LINUX_CLONE_LEN))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (memcmp (buf, linux_clone_code, LINUX_CLONE_LEN) != 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+amd64_linux_outermost_frame (struct frame_info *this_frame)
|
||||
+{
|
||||
+ CORE_ADDR pc = get_frame_pc (this_frame);
|
||||
+ const char *name;
|
||||
+
|
||||
+ find_pc_partial_function (pc, &name, NULL, NULL);
|
||||
+
|
||||
+ /* If we have NAME, we can optimize the search.
|
||||
+ `clone' NAME still needs to have the code checked as its name may be
|
||||
+ present in the user code.
|
||||
+ `__clone' NAME should not be present in the user code but in the initial
|
||||
+ parts of the `__clone' implementation the unwind still makes sense.
|
||||
+ More detailed unwinding decision would be too much sensitive to possible
|
||||
+ subtle changes in specific glibc revisions. */
|
||||
+ if (name == NULL || strcmp (name, "clone") == 0
|
||||
+ || strcmp ("__clone", name) == 0)
|
||||
+ return (amd64_linux_clone_running (this_frame) != 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
|
||||
{
|
||||
@@ -1808,6 +1882,8 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
|
||||
tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
|
||||
|
||||
+ tdep->outermost_frame_p = amd64_linux_outermost_frame;
|
||||
+
|
||||
/* Add the %orig_rax register used for syscall restarting. */
|
||||
set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc);
|
||||
|
||||
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
|
||||
--- a/gdb/amd64-tdep.c
|
||||
+++ b/gdb/amd64-tdep.c
|
||||
@@ -2601,6 +2601,7 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame,
|
||||
{
|
||||
struct amd64_frame_cache *cache =
|
||||
amd64_frame_cache (this_frame, this_cache);
|
||||
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
||||
|
||||
if (!cache->base_p)
|
||||
return UNWIND_UNAVAILABLE;
|
||||
@@ -2609,6 +2610,10 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame,
|
||||
if (cache->base == 0)
|
||||
return UNWIND_OUTERMOST;
|
||||
|
||||
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
||||
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
|
||||
+ return UNWIND_OUTERMOST;
|
||||
+
|
||||
return UNWIND_NO_REASON;
|
||||
}
|
||||
|
||||
@@ -2743,6 +2748,7 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||
{
|
||||
struct amd64_frame_cache *cache =
|
||||
amd64_sigtramp_frame_cache (this_frame, this_cache);
|
||||
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
||||
|
||||
if (!cache->base_p)
|
||||
(*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame));
|
||||
@@ -2751,6 +2757,11 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||
/* This marks the outermost frame. */
|
||||
return;
|
||||
}
|
||||
+ else if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
|
||||
+ {
|
||||
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
||||
+ return;
|
||||
+ }
|
||||
else
|
||||
(*this_id) = frame_id_build (cache->base + 16, get_frame_pc (this_frame));
|
||||
}
|
||||
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
|
||||
--- a/gdb/i386-tdep.c
|
||||
+++ b/gdb/i386-tdep.c
|
||||
@@ -8407,6 +8407,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
|
||||
tdep->xsave_xcr0_offset = -1;
|
||||
|
||||
+ /* Unwinding stops on i386 automatically. */
|
||||
+ tdep->outermost_frame_p = NULL;
|
||||
+
|
||||
tdep->record_regmap = i386_record_regmap;
|
||||
|
||||
set_gdbarch_type_align (gdbarch, i386_type_align);
|
||||
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
|
||||
--- a/gdb/i386-tdep.h
|
||||
+++ b/gdb/i386-tdep.h
|
||||
@@ -251,6 +251,9 @@ struct gdbarch_tdep
|
||||
|
||||
/* Regsets. */
|
||||
const struct regset *fpregset;
|
||||
+
|
||||
+ /* Detect OS dependent outermost frames; such as `clone'. */
|
||||
+ int (*outermost_frame_p) (struct frame_info *this_frame);
|
||||
};
|
||||
|
||||
/* Floating-point registers. */
|
||||
diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.c b/gdb/testsuite/gdb.threads/bt-clone-stop.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.c
|
||||
@@ -0,0 +1,39 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2006 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 2 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, write to the Free Software
|
||||
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+
|
||||
+void *threader (void *arg)
|
||||
+{
|
||||
+ assert (0);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ pthread_t t1;
|
||||
+
|
||||
+ pthread_create (&t1, NULL, threader, (void *) NULL);
|
||||
+ for (;;)
|
||||
+ pause();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.exp b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
|
||||
@@ -0,0 +1,61 @@
|
||||
+# Copyright 2006 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 2 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, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Backtraced `clone' must not have `PC == 0' as its previous frame.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+set testfile bt-clone-stop
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# threader: threader.c:8: threader: Assertion `0' failed.
|
||||
+# Program received signal SIGABRT, Aborted.
|
||||
+
|
||||
+gdb_test "run" \
|
||||
+ {Thread 2 "bt-clone-stop" received signal SIGABRT.*} \
|
||||
+ "run"
|
||||
+
|
||||
+# Former gdb unwind (the first function is `clone'):
|
||||
+# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
|
||||
+# #6 0x0000000000000000 in ?? ()
|
||||
+# (gdb)
|
||||
+# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'.
|
||||
+#
|
||||
+# Two `-re' cases below must be in this order (1st is a subset of the 2nd one).
|
||||
+# Unhandled case below should not happen and it is fortunately handled by
|
||||
+# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid').
|
||||
+gdb_test_multiple "bt" "0x0 entry output invalid" {
|
||||
+ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
|
||||
+ fail "0x0 entry found"
|
||||
+ }
|
||||
+ -re "in threader \\(.*$gdb_prompt $" {
|
||||
+ pass "0x0 entry not found"
|
||||
+ }
|
||||
+}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -92,4 +90,3 @@ new file mode 100644
|
||||
+ fail "stepped into trampoline"
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
|
||||
|
||||
diff --git a/gdb/symtab.c b/gdb/symtab.c
|
||||
--- a/gdb/symtab.c
|
||||
+++ b/gdb/symtab.c
|
||||
@@ -3177,6 +3177,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
|
||||
SYMBOL_LINKAGE_NAME (msymbol)); */
|
||||
@@ -3166,6 +3166,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
|
||||
msymbol->linkage_name ()); */
|
||||
;
|
||||
/* fall through */
|
||||
+ /* `msymbol' trampoline may be located before its .text symbol
|
||||
@ -12,9 +10,8 @@ diff --git a/gdb/symtab.c b/gdb/symtab.c
|
||||
+ Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop.
|
||||
+ Red Hat Bug 218379. */
|
||||
+ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc)
|
||||
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", MSYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc));
|
||||
+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc));
|
||||
+ /* fall through */
|
||||
else
|
||||
return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -78,4 +78,3 @@ new file mode 100644
|
||||
+} else {
|
||||
+ fail $test
|
||||
+}
|
||||
|
||||
|
||||
@ -139,4 +139,3 @@ new file mode 100644
|
||||
+
|
||||
+# Cleanup.
|
||||
+exec kill -9 $pid_of_bin
|
||||
|
||||
|
||||
@ -120,4 +120,3 @@ new file mode 100644
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
@ -52,4 +52,3 @@ new file mode 100644
|
||||
+ "Read the last address space byte"
|
||||
+
|
||||
+set timeout ${timeoutold}
|
||||
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
Fix has been committed to:
|
||||
gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -85,4 +82,3 @@ new file mode 100644
|
||||
+# we step from as in this case it is a valid upstream KFAIL gdb/38
|
||||
+
|
||||
+gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint"
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -109,4 +107,3 @@ new file mode 100644
|
||||
+ "No executable file specified..*" \
|
||||
+ "All the characters transferred"
|
||||
+}
|
||||
|
||||
|
||||
@ -112,4 +112,3 @@ new file mode 100644
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*${srcfilemain}.*" \
|
||||
+ "start"
|
||||
|
||||
|
||||
@ -1,25 +1,3 @@
|
||||
If you provided some relative path to the shared library, such as with
|
||||
export LD_LIBRARY_PATH=.
|
||||
then gdb would fail to match the shared library name during the TLS lookup.
|
||||
|
||||
Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed?
|
||||
|
||||
The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'.
|
||||
The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
||||
|
||||
2006-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute
|
||||
requested pathnames to the internal loaded relative pathnames.
|
||||
|
||||
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.7.
|
||||
|
||||
2008-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to gdb-6.7.50.20080227.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -169,4 +147,3 @@ new file mode 100644
|
||||
+ "\\\$1 = \[0-9\].*" \
|
||||
+ "print TLS variable from a shared library with $name-directory separate debug info file"
|
||||
+}
|
||||
|
||||
|
||||
@ -1,84 +1,16 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html
|
||||
|
||||
[ Fixed up since the mail. ]
|
||||
|
||||
On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote:
|
||||
> Not an exhaustive list, but if we go down the path of converting "gdb
|
||||
> corefile" to "gdb -c corefile", then we also need to think about "file
|
||||
> corefile" being converted to "core corefile" [or "target core
|
||||
> corefile", "core" is apparently deprecated in favor of "target core"]
|
||||
> and "target exec corefile" -> "target core corefile". Presumably
|
||||
> "file corefile" (and "target exec corefile") would discard the
|
||||
> currently selected executable. But maybe not. Will that be confusing
|
||||
> for users? I don't know.
|
||||
|
||||
While thinking about it overriding some GDB _commands_ was not my intention.
|
||||
|
||||
There is a general assumption if I have a shell COMMAND and some FILE I can do
|
||||
$ COMMAND FILE
|
||||
and COMMAND will appropriately load the FILE.
|
||||
|
||||
FSF GDB currently needs to specify also the executable file for core files
|
||||
which already inhibits this intuitive expectation. OTOH with the build-id
|
||||
locating patch which could allow such intuitive start notneeding the
|
||||
executable file. Still it currently did not work due to the required "-c":
|
||||
$ COMMAND -c COREFILE
|
||||
|
||||
Entering "file", "core-file" or "attach" commands is already explicit enough
|
||||
so that it IMO should do what the command name says without any
|
||||
autodetections. The second command line argument
|
||||
(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but
|
||||
neither "attach" accepts a core file nor "core-file" accepts a PID.
|
||||
|
||||
The patch makes sense only with the build-id patchset so this is not submit
|
||||
for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending
|
||||
bfd_check_format_matches) as the patch below is its natural extension.
|
||||
|
||||
Sorry for the delay,
|
||||
Jan
|
||||
|
||||
2010-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* exceptions.h (enum errors <IS_CORE_ERROR>): New.
|
||||
* exec.c: Include exceptions.h.
|
||||
(exec_file_attach <bfd_core>): Call throw_error (IS_CORE_ERROR, ...).
|
||||
* main.c (exec_or_core_file_attach): New.
|
||||
(captured_main <optind < argc>): Set also corearg.
|
||||
(captured_main <strcmp (execarg, symarg) == 0>): New variable func.
|
||||
Call exec_or_core_file_attach if COREARG matches EXECARG. Call
|
||||
symbol_file_add_main only if CORE_BFD remained NULL.
|
||||
|
||||
Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
|
||||
2010-01-20 Doug Evans <dje@google.com>
|
||||
|
||||
* exec.c (exec_file_attach): Print a more useful error message if the
|
||||
user did "gdb core".
|
||||
|
||||
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
|
||||
--- a/gdb/common/common-exceptions.h
|
||||
+++ b/gdb/common/common-exceptions.h
|
||||
@@ -104,6 +104,9 @@ enum errors {
|
||||
"_ERROR" is appended to the name. */
|
||||
MAX_COMPLETIONS_REACHED_ERROR,
|
||||
|
||||
+ /* Attempt to load a core file as executable. */
|
||||
+ IS_CORE_ERROR,
|
||||
+
|
||||
/* Add more errors here. */
|
||||
NR_ERRORS
|
||||
};
|
||||
diff --git a/gdb/exec.c b/gdb/exec.c
|
||||
--- a/gdb/exec.c
|
||||
+++ b/gdb/exec.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gdb_bfd.h"
|
||||
#include "gcore.h"
|
||||
#include "source.h"
|
||||
+#include "exceptions.h"
|
||||
@@ -18,6 +18,8 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "readline/readline.h"
|
||||
@@ -355,12 +356,27 @@ exec_file_attach (const char *filename, int from_tty)
|
||||
#include "defs.h"
|
||||
+#include "arch-utils.h"
|
||||
+#include "exceptions.h"
|
||||
#include "frame.h"
|
||||
#include "inferior.h"
|
||||
#include "target.h"
|
||||
@@ -345,12 +347,27 @@ exec_file_attach (const char *filename, int from_tty)
|
||||
|
||||
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
|
||||
{
|
||||
@ -99,20 +31,33 @@ diff --git a/gdb/exec.c b/gdb/exec.c
|
||||
+
|
||||
+ if (is_core != 0)
|
||||
+ throw_error (IS_CORE_ERROR,
|
||||
+ _("\"%s\" is a core file.\n"
|
||||
+ "Please specify an executable to debug."),
|
||||
+ scratch_pathname);
|
||||
+ _("\"%s\" is a core file.\n"
|
||||
+ "Please specify an executable to debug."),
|
||||
+ scratch_pathname);
|
||||
+ else
|
||||
+ error (_("\"%s\": not in executable format: %s"),
|
||||
+ error (_("\"%ss\": not in executable format: %s"),
|
||||
+ scratch_pathname,
|
||||
+ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
|
||||
}
|
||||
|
||||
if (build_section_table (exec_bfd, §ions, §ions_end))
|
||||
diff --git a/gdb/gdbsupport/common-exceptions.h b/gdb/gdbsupport/common-exceptions.h
|
||||
--- a/gdb/gdbsupport/common-exceptions.h
|
||||
+++ b/gdb/gdbsupport/common-exceptions.h
|
||||
@@ -106,6 +106,9 @@ enum errors {
|
||||
"_ERROR" is appended to the name. */
|
||||
MAX_COMPLETIONS_REACHED_ERROR,
|
||||
|
||||
+ /* Attempt to load a core file as executable. */
|
||||
+ IS_CORE_ERROR,
|
||||
+
|
||||
/* Add more errors here. */
|
||||
NR_ERRORS
|
||||
};
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -448,6 +448,35 @@ struct cmdarg
|
||||
@@ -467,6 +467,34 @@ struct cmdarg
|
||||
char *string;
|
||||
};
|
||||
|
||||
@ -125,11 +70,11 @@ diff --git a/gdb/main.c b/gdb/main.c
|
||||
+{
|
||||
+ gdb_assert (exec_bfd == NULL);
|
||||
+
|
||||
+ TRY
|
||||
+ try
|
||||
+ {
|
||||
+ exec_file_attach (filename, from_tty);
|
||||
+ }
|
||||
+ CATCH (e, RETURN_MASK_ALL)
|
||||
+ catch (gdb_exception_error &e)
|
||||
+ {
|
||||
+ if (e.error == IS_CORE_ERROR)
|
||||
+ {
|
||||
@ -140,15 +85,14 @@ diff --git a/gdb/main.c b/gdb/main.c
|
||||
+ if (exec_bfd != NULL)
|
||||
+ return;
|
||||
+ }
|
||||
+ throw_exception (e);
|
||||
+ throw_exception (std::move (e));
|
||||
+ }
|
||||
+ END_CATCH
|
||||
+}
|
||||
+
|
||||
static void
|
||||
captured_main_1 (struct captured_main_args *context)
|
||||
{
|
||||
@@ -893,6 +922,8 @@ captured_main_1 (struct captured_main_args *context)
|
||||
@@ -907,6 +935,8 @@ captured_main_1 (struct captured_main_args *context)
|
||||
{
|
||||
symarg = argv[optind];
|
||||
execarg = argv[optind];
|
||||
@ -157,7 +101,7 @@ diff --git a/gdb/main.c b/gdb/main.c
|
||||
optind++;
|
||||
}
|
||||
|
||||
@@ -1043,12 +1074,25 @@ captured_main_1 (struct captured_main_args *context)
|
||||
@@ -1063,12 +1093,25 @@ captured_main_1 (struct captured_main_args *context)
|
||||
&& symarg != NULL
|
||||
&& strcmp (execarg, symarg) == 0)
|
||||
{
|
||||
@ -187,4 +131,3 @@ diff --git a/gdb/main.c b/gdb/main.c
|
||||
ret = catch_command_errors (symbol_file_add_main_adapter,
|
||||
symarg, !batch_flag);
|
||||
}
|
||||
|
||||
|
||||
@ -1,20 +1,3 @@
|
||||
Comments by Sergio Durigan Junior <sergiodj@redhat.com>:
|
||||
|
||||
This is the fix for RH BZ #981154
|
||||
|
||||
It is mainly a testcase addition, but a minor fix in the gdb/build-id.c
|
||||
file was also needed.
|
||||
|
||||
gdb/build-id.c was added by:
|
||||
|
||||
commit dc294be54c96414035eed7d53dafdea0a6f31a72
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Tue Oct 8 19:56:15 2013 +0000
|
||||
|
||||
and had a little thinko there. The variable 'filename' needs to be set to
|
||||
NULL after it is free'd, otherwise the code below thinks that it is still
|
||||
valid and doesn't print the necessary warning ("Try: yum install ...").
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -117,4 +100,3 @@ new file mode 100644
|
||||
+
|
||||
+# Leaving the link there will cause breakage in the next run.
|
||||
+remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]"
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -712,6 +712,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
||||
@@ -709,6 +709,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
@ -32,4 +32,3 @@ diff --git a/gdb/proc-service.list b/gdb/proc-service.list
|
||||
+ /* gdb-6.6-buildid-locate-rpm.patch */
|
||||
+ rpmsqEnable;
|
||||
};
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
warning: Skipping deprecated .gdb_index section
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=953585
|
||||
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -746,7 +746,11 @@ static int missing_rpm_list_entries;
|
||||
@@ -743,7 +743,11 @@ static int missing_rpm_list_entries;
|
||||
/* Returns the count of newly added rpms. */
|
||||
|
||||
static int
|
||||
@ -16,7 +13,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
{
|
||||
static int rpm_init_done = 0;
|
||||
rpmts ts;
|
||||
@@ -853,7 +857,11 @@ missing_rpm_enlist (const char *filename)
|
||||
@@ -850,7 +854,11 @@ missing_rpm_enlist (const char *filename)
|
||||
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
||||
if (mi != NULL)
|
||||
{
|
||||
@ -28,7 +25,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
{
|
||||
Header h;
|
||||
char *debuginfo, **slot, *s, *s2;
|
||||
@@ -971,6 +979,37 @@ missing_rpm_enlist (const char *filename)
|
||||
@@ -968,6 +976,37 @@ missing_rpm_enlist (const char *filename)
|
||||
xfree (debuginfo);
|
||||
count++;
|
||||
}
|
||||
@ -66,10 +63,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
|
||||
rpmdbFreeIterator_p (mi);
|
||||
}
|
||||
@@ -981,6 +1020,21 @@ missing_rpm_enlist (const char *filename)
|
||||
@@ -977,6 +1016,20 @@ missing_rpm_enlist (const char *filename)
|
||||
return count;
|
||||
}
|
||||
|
||||
static int
|
||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||
+missing_rpm_enlist (const char *filename)
|
||||
+{
|
||||
@ -82,16 +79,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+{
|
||||
+ return missing_rpm_enlist_1 (filename, 1);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+#endif
|
||||
missing_rpm_list_compar (const char *const *ap, const char *const *bp)
|
||||
+
|
||||
static bool
|
||||
missing_rpm_list_compar (const char *ap, const char *bp)
|
||||
{
|
||||
return strcoll (*ap, *bp);
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -3501,6 +3501,16 @@ read_gdb_index_from_buffer (struct objfile *objfile,
|
||||
@@ -3497,6 +3497,16 @@ read_gdb_index_from_buffer (struct objfile *objfile,
|
||||
"set use-deprecated-index-sections on". */
|
||||
if (version < 6 && !deprecated_ok)
|
||||
{
|
||||
@ -108,7 +104,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
static int warning_printed = 0;
|
||||
if (!warning_printed)
|
||||
{
|
||||
@@ -3512,6 +3522,10 @@ to use the section anyway."),
|
||||
@@ -3508,6 +3518,10 @@ to use the section anyway."),
|
||||
warning_printed = 1;
|
||||
}
|
||||
return 0;
|
||||
@ -119,4 +115,3 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
}
|
||||
/* Version 7 indices generated by gold refer to the CU for a symbol instead
|
||||
of the TU (for symbols coming from TUs),
|
||||
|
||||
|
||||
@ -228,16 +228,15 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "elf/common.h"
|
||||
#include "elf-bfd.h"
|
||||
#include <sys/stat.h>
|
||||
+#include "elf/external.h"
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "gdb_bfd.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "gdbcore.h"
|
||||
+#include "inferior.h"
|
||||
|
||||
#define BUILD_ID_VERBOSE_NONE 0
|
||||
#define BUILD_ID_VERBOSE_FILENAMES 1
|
||||
@@ -700,8 +702,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
||||
#include "libbfd.h"
|
||||
#include "objfiles.h"
|
||||
#include "observable.h"
|
||||
@@ -698,8 +699,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -506,10 +505,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+missing_rpm_list_compar (const char *const *ap, const char *const *bp)
|
||||
+static bool
|
||||
+missing_rpm_list_compar (const char *ap, const char *bp)
|
||||
+{
|
||||
+ return strcoll (*ap, *bp);
|
||||
+ return strcoll (ap, bp) < 0;
|
||||
+}
|
||||
+
|
||||
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
|
||||
@ -518,39 +517,50 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+static void
|
||||
+missing_rpm_list_print (void)
|
||||
+{
|
||||
+ char **array, **array_iter;
|
||||
+ struct missing_rpm *list_iter;
|
||||
+ struct cleanup *cleanups;
|
||||
+
|
||||
+ if (missing_rpm_list_entries == 0)
|
||||
+ return;
|
||||
+
|
||||
+ array = (char **) xmalloc (sizeof (*array) * missing_rpm_list_entries);
|
||||
+ cleanups = make_cleanup (xfree, array);
|
||||
+ std::vector<const char *> array (missing_rpm_list_entries);
|
||||
+ size_t idx = 0;
|
||||
+
|
||||
+ array_iter = array;
|
||||
+ for (list_iter = missing_rpm_list; list_iter != NULL;
|
||||
+ list_iter = list_iter->next)
|
||||
+ {
|
||||
+ *array_iter++ = list_iter->rpm;
|
||||
+ array[idx++] = list_iter->rpm;
|
||||
+ }
|
||||
+ gdb_assert (array_iter == array + missing_rpm_list_entries);
|
||||
+ gdb_assert (idx == missing_rpm_list_entries);
|
||||
+
|
||||
+ qsort (array, missing_rpm_list_entries, sizeof (*array),
|
||||
+ (int (*) (const void *, const void *)) missing_rpm_list_compar);
|
||||
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
|
||||
+
|
||||
+ /* We zero out the number of missing RPMs here because of a nasty
|
||||
+ bug (see RHBZ 1801974).
|
||||
+
|
||||
+ When we call 'puts_unfiltered' below, if pagination is on and if
|
||||
+ the number of missing RPMs is big enough to trigger pagination,
|
||||
+ we will end up in an infinite recursion. The call chain looks
|
||||
+ like this:
|
||||
+
|
||||
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
|
||||
+ -> prompt_for_continue -> display_gdb_prompt ->
|
||||
+ debug_flush_missing -> missing_rpm_list_print ...
|
||||
+
|
||||
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
|
||||
+ *before* calling any print function. */
|
||||
+ missing_rpm_list_entries = 0;
|
||||
+
|
||||
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
||||
+#ifdef DNF_DEBUGINFO_INSTALL
|
||||
+ "dnf "
|
||||
+#endif
|
||||
+ "debuginfo-install");
|
||||
+ for (array_iter = array; array_iter < array + missing_rpm_list_entries;
|
||||
+ array_iter++)
|
||||
+ for (const char *el : array)
|
||||
+ {
|
||||
+ putchar_unfiltered (' ');
|
||||
+ puts_unfiltered (*array_iter);
|
||||
+ puts_unfiltered (" ");
|
||||
+ puts_unfiltered (el);
|
||||
+ }
|
||||
+ putchar_unfiltered ('\n');
|
||||
+ puts_unfiltered ("\n");
|
||||
+
|
||||
+ while (missing_rpm_list != NULL)
|
||||
+ {
|
||||
@ -558,9 +568,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ missing_rpm_list = list_iter->next;
|
||||
+ xfree (list_iter);
|
||||
+ }
|
||||
+ missing_rpm_list_entries = 0;
|
||||
+
|
||||
+ do_cleanups (cleanups);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
@ -605,7 +612,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
avoidance. */
|
||||
|
||||
struct missing_filepair
|
||||
@@ -755,11 +1115,17 @@ missing_filepair_change (void)
|
||||
@@ -753,11 +1120,17 @@ missing_filepair_change (void)
|
||||
/* All their memory came just from missing_filepair_OBSTACK. */
|
||||
missing_filepair_hash = NULL;
|
||||
}
|
||||
@ -623,7 +630,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
missing_filepair_change ();
|
||||
}
|
||||
|
||||
@@ -826,14 +1192,39 @@ debug_print_missing (const char *binary, const char *debug)
|
||||
@@ -824,14 +1197,38 @@ debug_print_missing (const char *binary, const char *debug)
|
||||
|
||||
*slot = missing_filepair;
|
||||
|
||||
@ -632,14 +639,13 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+#ifdef HAVE_LIBRPM
|
||||
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
|
||||
+ {
|
||||
+ char *execfilename;
|
||||
+ const char *execfilename = get_exec_file (0);
|
||||
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- _("Missing separate debuginfo for %s\n"), binary);
|
||||
- if (debug != NULL)
|
||||
- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
|
||||
- debug);
|
||||
+ execfilename = get_exec_file (0);
|
||||
+ if (execfilename != NULL)
|
||||
+ {
|
||||
+ if (missing_rpm_enlist (execfilename) == 0)
|
||||
@ -673,7 +679,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
diff --git a/gdb/config.in b/gdb/config.in
|
||||
--- a/gdb/config.in
|
||||
+++ b/gdb/config.in
|
||||
@@ -33,6 +33,9 @@
|
||||
@@ -36,6 +36,9 @@
|
||||
/* Define to BFD's default target vector. */
|
||||
#undef DEFAULT_BFD_VEC
|
||||
|
||||
@ -683,9 +689,9 @@ diff --git a/gdb/config.in b/gdb/config.in
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
#undef ENABLE_NLS
|
||||
@@ -261,6 +264,9 @@
|
||||
/* Define if Python 2.7 is being used. */
|
||||
#undef HAVE_LIBPYTHON2_7
|
||||
@@ -245,6 +248,9 @@
|
||||
/* Define if you have the mpfr library. */
|
||||
#undef HAVE_LIBMPFR
|
||||
|
||||
+/* Define if librpm library is being used. */
|
||||
+#undef HAVE_LIBRPM
|
||||
@ -696,7 +702,7 @@ diff --git a/gdb/config.in b/gdb/config.in
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -751,6 +751,11 @@ CODESIGN_CERT
|
||||
@@ -761,6 +761,11 @@ CODESIGN_CERT
|
||||
HAVE_NATIVE_GCORE_TARGET
|
||||
TARGET_OBS
|
||||
subdirs
|
||||
@ -708,7 +714,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
GDB_DATADIR
|
||||
DEBUGDIR
|
||||
MAKEINFO_EXTRA_FLAGS
|
||||
@@ -855,6 +860,7 @@ with_gdb_datadir
|
||||
@@ -864,6 +869,7 @@ with_gdb_datadir
|
||||
with_relocated_sources
|
||||
with_auto_load_dir
|
||||
with_auto_load_safe_path
|
||||
@ -716,7 +722,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
enable_targets
|
||||
enable_64_bit_bfd
|
||||
enable_gdbmi
|
||||
@@ -915,6 +921,11 @@ CCC
|
||||
@@ -926,6 +932,11 @@ CCC
|
||||
CPP
|
||||
MAKEINFO
|
||||
MAKEINFOFLAGS
|
||||
@ -728,7 +734,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
YACC
|
||||
YFLAGS
|
||||
XMKMF'
|
||||
@@ -1588,6 +1599,8 @@ Optional Packages:
|
||||
@@ -1598,6 +1609,8 @@ Optional Packages:
|
||||
[--with-auto-load-dir]
|
||||
--without-auto-load-safe-path
|
||||
do not restrict auto-loaded files locations
|
||||
@ -737,7 +743,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
|
||||
--with-curses use the curses library instead of the termcap
|
||||
library
|
||||
@@ -1645,6 +1658,13 @@ Some influential environment variables:
|
||||
@@ -1661,6 +1674,13 @@ Some influential environment variables:
|
||||
MAKEINFO Parent configure detects if it is of sufficient version.
|
||||
MAKEINFOFLAGS
|
||||
Parameters for MAKEINFO.
|
||||
@ -751,7 +757,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
YACC The `Yet Another Compiler Compiler' implementation to use.
|
||||
Defaults to the first program found out of: `bison -y', `byacc',
|
||||
`yacc'.
|
||||
@@ -6626,6 +6646,494 @@ _ACEOF
|
||||
@@ -6587,6 +6607,494 @@ _ACEOF
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
|
||||
$as_echo "$with_auto_load_safe_path" >&6; }
|
||||
|
||||
@ -1249,7 +1255,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
|
||||
@@ -144,6 +144,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
|
||||
[Directories safe to hold auto-loaded files.])
|
||||
AC_MSG_RESULT([$with_auto_load_safe_path])
|
||||
|
||||
@ -1449,30 +1455,18 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
AC_CONFIG_SUBDIRS(testsuite)
|
||||
|
||||
# Check whether to support alternative target configurations
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -365,7 +365,7 @@ build_id_locate_exec (int from_tty)
|
||||
symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
|
||||
}
|
||||
else
|
||||
- debug_print_missing (_("the main executable file"), build_id_filename);
|
||||
+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
|
||||
|
||||
do_cleanups (back_to);
|
||||
|
||||
diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
--- a/gdb/event-top.c
|
||||
+++ b/gdb/event-top.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "common/buffer.h"
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "ser-event.h"
|
||||
#include "gdb_select.h"
|
||||
#include "gdbsupport/gdb-sigmask.h"
|
||||
+#include "symfile.h"
|
||||
|
||||
/* readline include files. */
|
||||
#include "readline/readline.h"
|
||||
@@ -359,6 +360,8 @@ display_gdb_prompt (const char *new_prompt)
|
||||
@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
|
||||
/* Reset the nesting depth used when trace-commands is set. */
|
||||
reset_command_nest_depth ();
|
||||
|
||||
@ -1481,7 +1475,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
/* Do not call the python hook on an explicit prompt change as
|
||||
passed to this function, as this forms a secondary/local prompt,
|
||||
IE, displayed but not set. */
|
||||
@@ -770,7 +773,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
|
||||
@@ -772,7 +775,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
|
||||
command_handler (cmd);
|
||||
|
||||
if (ui->prompt_state != PROMPTED)
|
||||
@ -1496,7 +1490,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
diff --git a/gdb/symfile.h b/gdb/symfile.h
|
||||
--- a/gdb/symfile.h
|
||||
+++ b/gdb/symfile.h
|
||||
@@ -534,6 +534,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
|
||||
@@ -542,6 +542,8 @@ extern void generic_load (const char *args, int from_tty);
|
||||
/* build-id support. */
|
||||
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
|
||||
extern void debug_print_missing (const char *binary, const char *debug);
|
||||
@ -1505,4 +1499,3 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
|
||||
|
||||
/* From dwarf2read.c */
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
gdb returns an incorrect back trace when applying a debuginfo
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1339862
|
||||
|
||||
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
||||
--- a/gdb/solib-svr4.c
|
||||
+++ b/gdb/solib-svr4.c
|
||||
@@ -1347,14 +1347,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
@@ -1346,14 +1346,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
}
|
||||
|
||||
{
|
||||
@ -34,7 +31,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
||||
if (build_id != NULL)
|
||||
{
|
||||
char *name, *build_id_filename;
|
||||
@@ -1369,23 +1382,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
@@ -1368,23 +1381,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
xfree (name);
|
||||
}
|
||||
else
|
||||
@ -225,4 +222,3 @@ new file mode 100644
|
||||
+
|
||||
+gdb_test "bt"
|
||||
+gdb_test "info shared"
|
||||
|
||||
|
||||
@ -1,19 +1,47 @@
|
||||
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
|
||||
--- a/bfd/libbfd-in.h
|
||||
+++ b/bfd/libbfd-in.h
|
||||
@@ -127,7 +127,7 @@ static inline char *
|
||||
bfd_strdup (const char *str)
|
||||
{
|
||||
size_t len = strlen (str) + 1;
|
||||
- char *buf = bfd_malloc (len);
|
||||
+ char *buf = (char *) bfd_malloc (len);
|
||||
if (buf != NULL)
|
||||
memcpy (buf, str, len);
|
||||
return buf;
|
||||
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
|
||||
--- a/bfd/libbfd.h
|
||||
+++ b/bfd/libbfd.h
|
||||
@@ -132,7 +132,7 @@ static inline char *
|
||||
bfd_strdup (const char *str)
|
||||
{
|
||||
size_t len = strlen (str) + 1;
|
||||
- char *buf = bfd_malloc (len);
|
||||
+ char *buf = (char *) bfd_malloc (len);
|
||||
if (buf != NULL)
|
||||
memcpy (buf, str, len);
|
||||
return buf;
|
||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
--- a/gdb/build-id.c
|
||||
+++ b/gdb/build-id.c
|
||||
@@ -26,11 +26,67 @@
|
||||
@@ -24,13 +24,71 @@
|
||||
#include "gdbsupport/gdb_vecs.h"
|
||||
#include "symfile.h"
|
||||
#include "objfiles.h"
|
||||
#include "filenames.h"
|
||||
#include "gdbcore.h"
|
||||
+#include "libbfd.h"
|
||||
+#include "gdbcore.h"
|
||||
+#include "gdbcmd.h"
|
||||
+#include "observable.h"
|
||||
+#include <sys/stat.h>
|
||||
+#include "elf-bfd.h"
|
||||
+#include "elf/common.h"
|
||||
+#include "elf/external.h"
|
||||
+#include "elf/internal.h"
|
||||
+#include "elf/common.h"
|
||||
+#include "elf-bfd.h"
|
||||
+#include <sys/stat.h>
|
||||
#include "filenames.h"
|
||||
+#include "gdb_bfd.h"
|
||||
+#include "gdbcmd.h"
|
||||
#include "gdbcore.h"
|
||||
+#include "libbfd.h"
|
||||
+#include "objfiles.h"
|
||||
+#include "observable.h"
|
||||
+#include "symfile.h"
|
||||
+
|
||||
+#define BUILD_ID_VERBOSE_NONE 0
|
||||
+#define BUILD_ID_VERBOSE_FILENAMES 1
|
||||
@ -68,9 +96,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
-build_id_bfd_get (bfd *abfd)
|
||||
+build_id_bfd_shdr_get (bfd *abfd)
|
||||
{
|
||||
if (!bfd_check_format (abfd, bfd_object))
|
||||
return NULL;
|
||||
@@ -42,6 +98,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
if (!bfd_check_format (abfd, bfd_object)
|
||||
&& !bfd_check_format (abfd, bfd_core))
|
||||
@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -359,7 +387,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+
|
||||
+static void build_id_addr_candidate (bfd *abfd, asection *sect, void *obj)
|
||||
+{
|
||||
+ if (build_id_addr >= bfd_section_vma (abfd, sect))
|
||||
+ if (build_id_addr >= bfd_section_vma (sect))
|
||||
+ {
|
||||
+ struct build_id_addr_sect *candidate;
|
||||
+
|
||||
@ -394,7 +422,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ candidate = candidate->next)
|
||||
+ {
|
||||
+ i_phdr = elf_get_phdr (core_bfd,
|
||||
+ bfd_section_vma (core_bfd, candidate->sect),
|
||||
+ bfd_section_vma (candidate->sect),
|
||||
+ &e_phnum, &loadbase);
|
||||
+ if (i_phdr != NULL)
|
||||
+ break;
|
||||
@ -419,7 +447,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
/* See build-id.h. */
|
||||
|
||||
int
|
||||
@@ -50,7 +448,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
const struct bfd_build_id *found;
|
||||
int retval = 0;
|
||||
|
||||
@ -428,7 +456,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
|
||||
if (found == NULL)
|
||||
warning (_("File \"%s\" has no build-id, file skipped"),
|
||||
@@ -65,62 +463,173 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
@@ -66,56 +466,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -474,8 +502,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
-build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
|
||||
- const bfd_byte *build_id)
|
||||
+build_id_to_debug_bfd_1 (const std::string &orig_link, size_t build_id_len,
|
||||
+ const bfd_byte *build_id, char **link_return,
|
||||
+ int add_debug_suffix)
|
||||
+ const bfd_byte *build_id, char **link_return)
|
||||
{
|
||||
+ gdb_bfd_ref_ptr ret_bfd = {};
|
||||
+ std::string ret_link;
|
||||
@ -516,9 +543,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
- {
|
||||
- if (separate_debug_file_debug)
|
||||
- printf_unfiltered (_(" no, unable to open.\n"));
|
||||
+ if (add_debug_suffix)
|
||||
+ link += ".debug";
|
||||
+
|
||||
+ ret_link = link;
|
||||
+
|
||||
+ struct stat statbuf_trash;
|
||||
@ -543,7 +567,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
|
||||
- return {};
|
||||
+ /* We expect to be silent on the non-existing files. */
|
||||
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
|
||||
+
|
||||
@ -562,8 +587,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- return {};
|
||||
+
|
||||
+ ret_bfd = debug_bfd;
|
||||
+ break;
|
||||
}
|
||||
@ -575,6 +599,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
{
|
||||
if (separate_debug_file_debug)
|
||||
- printf_unfiltered (_(" no, build-id does not match.\n"));
|
||||
-
|
||||
- return {};
|
||||
+ printf_unfiltered (_(" yes!\n"));
|
||||
+ }
|
||||
+ else
|
||||
@ -583,15 +609,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ always the non-.%u-suffixed file. */
|
||||
+ std::string link0 = orig_link;
|
||||
+
|
||||
+ if (add_debug_suffix)
|
||||
+ link0 += ".debug";
|
||||
+
|
||||
+ /* If the symlink has target request to install the target.
|
||||
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
|
||||
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
|
||||
+ std::string link0_resolved (link_resolve (link0.c_str (), 0));
|
||||
|
||||
- return {};
|
||||
+
|
||||
+ if (link_all.empty ())
|
||||
+ link_all = link0_resolved;
|
||||
+ else
|
||||
@ -620,16 +642,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ return ret_bfd;
|
||||
}
|
||||
|
||||
/* See build-id.h. */
|
||||
/* Common code for finding BFDs of a given build-id. This function
|
||||
@@ -124,7 +627,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
|
||||
|
||||
gdb_bfd_ref_ptr
|
||||
-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
|
||||
+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id,
|
||||
+ char **link_return, int add_debug_suffix)
|
||||
static gdb_bfd_ref_ptr
|
||||
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
- const char *suffix)
|
||||
+ const char *suffix, char **link_return)
|
||||
{
|
||||
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
|
||||
cause "/.build-id/..." lookups. */
|
||||
@@ -143,16 +652,16 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
|
||||
@@ -147,16 +650,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
if (size > 0)
|
||||
{
|
||||
size--;
|
||||
@ -642,26 +665,25 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
while (size-- > 0)
|
||||
string_appendf (link, "%02x", (unsigned) *data++);
|
||||
|
||||
- link += ".debug";
|
||||
-
|
||||
link += suffix;
|
||||
|
||||
gdb_bfd_ref_ptr debug_bfd
|
||||
- = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
|
||||
+ = build_id_to_debug_bfd_1 (link, build_id_len, build_id,
|
||||
+ link_return, add_debug_suffix);
|
||||
+ = build_id_to_debug_bfd_1 (link, build_id_len, build_id, link_return);
|
||||
if (debug_bfd != NULL)
|
||||
return debug_bfd;
|
||||
|
||||
@@ -166,7 +675,8 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
|
||||
@@ -170,7 +674,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
|
||||
{
|
||||
link = gdb_sysroot + link;
|
||||
- debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id);
|
||||
+ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id,
|
||||
+ link_return, add_debug_suffix);
|
||||
+ link_return);
|
||||
if (debug_bfd != NULL)
|
||||
return debug_bfd;
|
||||
}
|
||||
@@ -175,22 +685,190 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
|
||||
@@ -179,38 +684,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -671,12 +693,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+ gdb_bfd_ref_ptr abfd;
|
||||
+ char *result;
|
||||
+
|
||||
+ abfd = build_id_to_debug_bfd (build_id->size, build_id->data, link_return, 0);
|
||||
+ abfd = build_id_to_exec_bfd (build_id->size, build_id->data, link_return);
|
||||
+ if (abfd == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ result = xstrdup (bfd_get_filename (abfd));
|
||||
+ abfd.release ();
|
||||
+ result = xstrdup (bfd_get_filename (abfd.get ()));
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
@ -818,6 +839,29 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
+
|
||||
/* See build-id.h. */
|
||||
|
||||
gdb_bfd_ref_ptr
|
||||
-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
|
||||
+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id,
|
||||
+ char **link_return)
|
||||
{
|
||||
- return build_id_to_bfd_suffix (build_id_len, build_id, ".debug");
|
||||
+ return build_id_to_bfd_suffix (build_id_len, build_id, ".debug",
|
||||
+ link_return);
|
||||
}
|
||||
|
||||
/* See build-id.h. */
|
||||
|
||||
gdb_bfd_ref_ptr
|
||||
-build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id)
|
||||
+build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id,
|
||||
+ char **link_return)
|
||||
{
|
||||
- return build_id_to_bfd_suffix (build_id_len, build_id, "");
|
||||
+ return build_id_to_bfd_suffix (build_id_len, build_id, "", link_return);
|
||||
}
|
||||
|
||||
/* See build-id.h. */
|
||||
|
||||
std::string
|
||||
-find_separate_debug_file_by_buildid (struct objfile *objfile)
|
||||
+find_separate_debug_file_by_buildid (struct objfile *objfile,
|
||||
@ -840,7 +884,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
|
||||
- build_id->data));
|
||||
+ build_id->data,
|
||||
+ (!build_id_filename_return ? NULL : &build_id_filename_cstr), 1));
|
||||
+ (!build_id_filename_return ? NULL : &build_id_filename_cstr)));
|
||||
+ if (build_id_filename_return)
|
||||
+ {
|
||||
+ if (!build_id_filename_cstr)
|
||||
@ -855,7 +899,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||
/* Prevent looping on a stripped .debug file. */
|
||||
if (abfd != NULL
|
||||
&& filename_cmp (bfd_get_filename (abfd.get ()),
|
||||
@@ -203,3 +881,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
|
||||
@@ -223,3 +898,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
|
||||
|
||||
return std::string ();
|
||||
}
|
||||
@ -882,7 +926,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
|
||||
+++ b/gdb/build-id.h
|
||||
@@ -23,9 +23,10 @@
|
||||
#include "gdb_bfd.h"
|
||||
#include "common/rsp-low.h"
|
||||
#include "gdbsupport/rsp-low.h"
|
||||
|
||||
-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */
|
||||
+/* Separate debuginfo files have corrupted PHDR but SHDR is correct there.
|
||||
@ -893,18 +937,26 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
|
||||
|
||||
/* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value.
|
||||
Otherwise, issue a warning and return false. */
|
||||
@@ -39,14 +40,19 @@ extern int build_id_verify (bfd *abfd,
|
||||
the caller. */
|
||||
@@ -38,21 +39,26 @@ extern int build_id_verify (bfd *abfd,
|
||||
can be found, return NULL. */
|
||||
|
||||
extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len,
|
||||
- const bfd_byte *build_id);
|
||||
+ const bfd_byte *build_id,
|
||||
+ char **link_return,
|
||||
+ int add_debug_suffix);
|
||||
+ char **link_return);
|
||||
+
|
||||
+extern char *build_id_to_filename (const struct bfd_build_id *build_id,
|
||||
+ char **link_return);
|
||||
|
||||
/* Find and open a BFD for an executable file given a build-id. If no BFD
|
||||
can be found, return NULL. The returned reference to the BFD must be
|
||||
released by the caller. */
|
||||
|
||||
extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len,
|
||||
- const bfd_byte *build_id);
|
||||
+ const bfd_byte *build_id,
|
||||
+ char **link_return);
|
||||
|
||||
/* Find the separate debug file for OBJFILE, by using the build-id
|
||||
associated with OBJFILE's BFD. If successful, returns the file name for the
|
||||
separate debug file, otherwise, return an empty string. */
|
||||
@ -919,7 +971,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
|
||||
diff --git a/gdb/coffread.c b/gdb/coffread.c
|
||||
--- a/gdb/coffread.c
|
||||
+++ b/gdb/coffread.c
|
||||
@@ -732,7 +732,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
@@ -709,7 +709,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
/* Try to add separate debug file if no symbols table found. */
|
||||
if (!objfile_has_partial_symbols (objfile))
|
||||
{
|
||||
@ -932,88 +984,55 @@ diff --git a/gdb/coffread.c b/gdb/coffread.c
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -43,6 +43,10 @@
|
||||
#include "gdb_bfd.h"
|
||||
#include "completer.h"
|
||||
#include "common/filestuff.h"
|
||||
@@ -22,6 +22,10 @@
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include "frame.h" /* required by inferior.h */
|
||||
+#include "auxv.h"
|
||||
+#include "build-id.h"
|
||||
+#include "elf/common.h"
|
||||
+#include "gdbcmd.h"
|
||||
+#include "build-id.h"
|
||||
|
||||
#ifndef O_LARGEFILE
|
||||
#define O_LARGEFILE 0
|
||||
@@ -320,6 +324,54 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
|
||||
#include "inferior.h"
|
||||
#include "infrun.h"
|
||||
#include "symtab.h"
|
||||
@@ -322,6 +326,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
|
||||
inferior_ptid = ptid; /* Yes, make it current. */
|
||||
}
|
||||
|
||||
+static int build_id_core_loads = 1;
|
||||
+
|
||||
+static void
|
||||
+build_id_locate_exec (int from_tty)
|
||||
+{
|
||||
+ CORE_ADDR at_entry;
|
||||
+ struct bfd_build_id *build_id;
|
||||
+ char *execfilename;
|
||||
+ char *build_id_filename;
|
||||
+ struct cleanup *back_to;
|
||||
+
|
||||
+ if (exec_bfd != NULL || symfile_objfile != NULL)
|
||||
+ return;
|
||||
+
|
||||
+ if (target_auxv_search (current_top_target (), AT_ENTRY, &at_entry) <= 0)
|
||||
+ return;
|
||||
+
|
||||
+ build_id = build_id_addr_get (at_entry);
|
||||
+ if (build_id == NULL)
|
||||
+ return;
|
||||
+ back_to = make_cleanup (xfree, build_id);
|
||||
+
|
||||
+ /* SYMFILE_OBJFILE should refer to the main executable (not only to its
|
||||
+ separate debug info file). gcc44+ keeps .eh_frame only in the main
|
||||
+ executable without its duplicate .debug_frame in the separate debug info
|
||||
+ file - such .eh_frame would not be found if SYMFILE_OBJFILE would refer
|
||||
+ directly to the separate debug info file. */
|
||||
+
|
||||
+ execfilename = build_id_to_filename (build_id, &build_id_filename);
|
||||
+ make_cleanup (xfree, build_id_filename);
|
||||
+
|
||||
+ if (execfilename != NULL)
|
||||
+ {
|
||||
+ make_cleanup (xfree, execfilename);
|
||||
+ exec_file_attach (execfilename, from_tty);
|
||||
+ symbol_file_add_main (execfilename,
|
||||
+ symfile_add_flag (!from_tty ? 0 : SYMFILE_VERBOSE));
|
||||
+ if (symfile_objfile != NULL)
|
||||
+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
|
||||
+ }
|
||||
+ else
|
||||
+ debug_print_missing (_("the main executable file"), build_id_filename);
|
||||
+
|
||||
+ do_cleanups (back_to);
|
||||
+
|
||||
+ /* No automatic SOLIB_ADD as the libraries would get read twice. */
|
||||
+}
|
||||
+static bool build_id_core_loads = true;
|
||||
+
|
||||
/* Issue a message saying we have no core to debug, if FROM_TTY. */
|
||||
|
||||
static void
|
||||
@@ -455,6 +507,14 @@ core_target_open (const char *arg, int from_tty)
|
||||
switch_to_thread (thread);
|
||||
@@ -358,19 +364,25 @@ core_file_command (const char *filename, int from_tty)
|
||||
static void
|
||||
locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
|
||||
{
|
||||
- const bfd_build_id *build_id = build_id_bfd_get (abfd);
|
||||
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (abfd);
|
||||
if (build_id == nullptr)
|
||||
return;
|
||||
|
||||
+ char *build_id_filename;
|
||||
gdb_bfd_ref_ptr execbfd
|
||||
- = build_id_to_exec_bfd (build_id->size, build_id->data);
|
||||
+ = build_id_to_exec_bfd (build_id->size, build_id->data,
|
||||
+ &build_id_filename);
|
||||
|
||||
if (execbfd != nullptr)
|
||||
{
|
||||
exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty);
|
||||
symbol_file_add_main (bfd_get_filename (execbfd.get ()),
|
||||
symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0));
|
||||
+ if (symfile_objfile != NULL)
|
||||
+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
|
||||
}
|
||||
+ else
|
||||
+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
|
||||
}
|
||||
|
||||
+ /* Find the build_id identifiers. If it gets executed after
|
||||
+ POST_CREATE_INFERIOR we would clash with asking to discard the already
|
||||
+ loaded VDSO symbols. If it gets executed before bfd_map_over_sections
|
||||
+ INFERIOR_PTID is still not set and libthread_db initialization crashes on
|
||||
+ PID == 0 in ps_pglobal_lookup. */
|
||||
+ if (build_id_core_loads != 0)
|
||||
+ build_id_locate_exec (from_tty);
|
||||
+
|
||||
post_create_inferior (target, from_tty);
|
||||
|
||||
/* Now go through the target stack looking for threads since there
|
||||
@@ -1063,4 +1123,11 @@ void
|
||||
/* See gdbcore.h. */
|
||||
@@ -998,4 +1010,11 @@ void
|
||||
_initialize_corelow (void)
|
||||
{
|
||||
add_target (core_target_info, core_target_open, filename_completer);
|
||||
@ -1028,7 +1047,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -19949,6 +19949,27 @@ information files.
|
||||
@@ -20862,6 +20862,27 @@ information files.
|
||||
|
||||
@end table
|
||||
|
||||
@ -1059,28 +1078,38 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c
|
||||
--- a/gdb/dwarf-index-cache.c
|
||||
+++ b/gdb/dwarf-index-cache.c
|
||||
@@ -93,7 +93,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
if (!enabled ())
|
||||
@@ -94,7 +94,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
return;
|
||||
|
||||
/* Get build id of objfile. */
|
||||
- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd);
|
||||
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd);
|
||||
if (build_id == nullptr)
|
||||
{
|
||||
if (debug_index_cache)
|
||||
@@ -112,7 +112,8 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
|
||||
if (dwz != nullptr)
|
||||
{
|
||||
- const bfd_build_id *dwz_build_id = build_id_bfd_get (dwz->dwz_bfd.get ());
|
||||
+ const bfd_build_id *dwz_build_id
|
||||
+ = build_id_bfd_shdr_get (dwz->dwz_bfd.get ());
|
||||
|
||||
if (dwz_build_id == nullptr)
|
||||
{
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -2727,7 +2727,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
@@ -2718,7 +2718,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
||||
}
|
||||
|
||||
if (dwz_bfd == NULL)
|
||||
- dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid);
|
||||
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL, 1);
|
||||
+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL);
|
||||
|
||||
if (dwz_bfd == NULL)
|
||||
error (_("could not find '.gnu_debugaltlink' file for %s"),
|
||||
@@ -6237,7 +6237,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
|
||||
@@ -6276,7 +6276,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
|
||||
static gdb::array_view<const gdb_byte>
|
||||
get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
|
||||
{
|
||||
@ -1089,7 +1118,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
if (build_id == nullptr)
|
||||
return {};
|
||||
|
||||
@@ -6250,7 +6250,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
|
||||
@@ -6289,7 +6289,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj)
|
||||
static gdb::array_view<const gdb_byte>
|
||||
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
|
||||
{
|
||||
@ -1101,7 +1130,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
diff --git a/gdb/elfread.c b/gdb/elfread.c
|
||||
--- a/gdb/elfread.c
|
||||
+++ b/gdb/elfread.c
|
||||
@@ -1287,7 +1287,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
@@ -1299,7 +1299,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
&& objfile->separate_debug_objfile == NULL
|
||||
&& objfile->separate_debug_objfile_backlink == NULL)
|
||||
{
|
||||
@ -1112,22 +1141,26 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
|
||||
|
||||
if (debugfile.empty ())
|
||||
debugfile = find_separate_debug_file_by_debuglink (objfile);
|
||||
@@ -1299,6 +1301,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
@@ -1311,8 +1313,12 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||
symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (),
|
||||
symfile_flags, objfile);
|
||||
}
|
||||
- else
|
||||
- has_dwarf2 = false;
|
||||
+ /* Check if any separate debug info has been extracted out. */
|
||||
+ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
|
||||
+ != NULL)
|
||||
+ debug_print_missing (objfile_name (objfile), build_id_filename.get ());
|
||||
+ else
|
||||
+ has_dwarf2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read the CTF section only if there is no DWARF info. */
|
||||
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
|
||||
--- a/gdb/objfiles.h
|
||||
+++ b/gdb/objfiles.h
|
||||
@@ -554,6 +554,10 @@ struct objfile
|
||||
htab_t static_links {};
|
||||
@@ -627,6 +627,10 @@ struct objfile
|
||||
htab_up static_links;
|
||||
};
|
||||
|
||||
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
|
||||
@ -1142,14 +1175,14 @@ diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
|
||||
+++ b/gdb/python/py-objfile.c
|
||||
@@ -132,7 +132,7 @@ objfpy_get_build_id (PyObject *self, void *closure)
|
||||
|
||||
TRY
|
||||
try
|
||||
{
|
||||
- build_id = build_id_bfd_get (objfile->obfd);
|
||||
+ build_id = build_id_bfd_shdr_get (objfile->obfd);
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
@@ -535,7 +535,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id)
|
||||
@@ -600,7 +600,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id)
|
||||
/* Don't return separate debug files. */
|
||||
if (objfile->separate_debug_objfile_backlink != NULL)
|
||||
continue;
|
||||
@ -1169,7 +1202,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
||||
|
||||
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
|
||||
static int svr4_have_link_map_offsets (void);
|
||||
@@ -1345,9 +1346,51 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
@@ -1344,9 +1345,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1227,10 +1260,17 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
||||
diff --git a/gdb/symfile.h b/gdb/symfile.h
|
||||
--- a/gdb/symfile.h
|
||||
+++ b/gdb/symfile.h
|
||||
@@ -531,6 +531,10 @@ void expand_symtabs_matching
|
||||
@@ -532,12 +532,17 @@ void expand_symtabs_matching
|
||||
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
|
||||
int need_fullname);
|
||||
|
||||
+
|
||||
/* Target-agnostic function to load the sections of an executable into memory.
|
||||
|
||||
ARGS should be in the form "EXECUTABLE [OFFSET]", where OFFSET is an
|
||||
optional offset to apply to each section. */
|
||||
extern void generic_load (const char *args, int from_tty);
|
||||
|
||||
+/* build-id support. */
|
||||
+extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
|
||||
+extern void debug_print_missing (const char *binary, const char *debug);
|
||||
@ -1289,10 +1329,10 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb
|
||||
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
--- a/gdb/testsuite/lib/gdb.exp
|
||||
+++ b/gdb/testsuite/lib/gdb.exp
|
||||
@@ -1716,6 +1716,16 @@ proc default_gdb_start { } {
|
||||
warning "Couldn't set the width to 0."
|
||||
@@ -1891,6 +1891,17 @@ proc default_gdb_start { } {
|
||||
}
|
||||
}
|
||||
|
||||
+ # Turn off the missing warnings as the testsuite does not expect it.
|
||||
+ send_gdb "set build-id-verbose 0\n"
|
||||
+ gdb_expect 10 {
|
||||
@ -1303,9 +1343,10 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
+ warning "Could not disable the missing debug infos warnings.."
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
gdb_debug_init
|
||||
return 0
|
||||
}
|
||||
|
||||
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
|
||||
--- a/gdb/testsuite/lib/mi-support.exp
|
||||
+++ b/gdb/testsuite/lib/mi-support.exp
|
||||
@ -1326,4 +1367,3 @@ diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
|
||||
|
||||
if { $separate_inferior_pty } {
|
||||
mi_create_inferior_pty
|
||||
|
||||
|
||||
@ -1,11 +1,3 @@
|
||||
2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb_gcore.sh: Redirect GDB from `</dev/null'.
|
||||
|
||||
2007-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/gcorebg.exp, gdb.base/gcorebg.c: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -178,4 +170,3 @@ new file mode 100644
|
||||
+
|
||||
+set env(PATH) $oldpath
|
||||
+remote_file target delete "./gdb"
|
||||
|
||||
|
||||
@ -1,9 +1,3 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000
|
||||
|
||||
The original testcase
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000#c1
|
||||
requires too recent GCC.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-power6.exp b/gdb/testsuite/gdb.arch/powerpc-power6.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -84,4 +78,3 @@ new file mode 100644
|
||||
+ .long 0xfc020444 /* ddivq f0,f2,f0 */
|
||||
+ .long 0xec820d04 /* dcmpu cr1,f2,f1 */
|
||||
+ .long 0xfc820504 /* dcmpuq cr1,f2,f0 */
|
||||
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/atomic-seq-threaded.c,
|
||||
gdb.threads/atomic-seq-threaded.exp: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -268,4 +263,3 @@ new file mode 100644
|
||||
+gdb_test "c" \
|
||||
+ ".*Program exited normally\\..*" \
|
||||
+ "run till program exit"
|
||||
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -2075,7 +2075,7 @@ static const char *const scheduler_enums[] = {
|
||||
schedlock_replay,
|
||||
NULL
|
||||
};
|
||||
-static const char *scheduler_mode = schedlock_replay;
|
||||
+static const char *scheduler_mode = schedlock_step;
|
||||
static void
|
||||
show_scheduler_mode (struct ui_file *file, int from_tty,
|
||||
struct cmd_list_element *c, const char *value)
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
|
||||
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
|
||||
@@ -199,7 +199,7 @@ mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" \
|
||||
# Test that the token is output even for CLI commands
|
||||
# Also test that *stopped includes frame information.
|
||||
mi_gdb_test "34 next" \
|
||||
- ".*34\\\^running.*\\*running,thread-id=\"all\"" \
|
||||
+ ".*34\\\^running.*\\*running,thread-id=\"1\"" \
|
||||
"34 next: run"
|
||||
|
||||
# Test that the new current source line is output to the console
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
|
||||
--- a/gdb/testsuite/gdb.mi/mi-console.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-console.exp
|
||||
@@ -60,6 +60,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
|
||||
mi_run_to_main
|
||||
|
||||
+# thread-id=\"all\" vs. thread-id=\"1\" below:
|
||||
+mi_gdb_test "210-gdb-set scheduler-locking off" "210\\^done" "set scheduler-locking off"
|
||||
+
|
||||
# The output we get from the target depends on how it is hosted. If
|
||||
# we are semihosted (e.g., the sim or a remote target that supports
|
||||
# the File I/O remote protocol extension), we see the target I/O
|
||||
diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp
|
||||
--- a/gdb/testsuite/gdb.mi/mi-logging.exp
|
||||
+++ b/gdb/testsuite/gdb.mi/mi-logging.exp
|
||||
@@ -53,7 +53,7 @@ close $chan
|
||||
|
||||
set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+"
|
||||
|
||||
-if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
+if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
pass "log file contents"
|
||||
} else {
|
||||
fail "log file contents"
|
||||
@@ -76,7 +76,7 @@ set chan [open $milogfile]
|
||||
set logcontent [read $chan]
|
||||
close $chan
|
||||
|
||||
-if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
+if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
|
||||
pass "redirect log file contents"
|
||||
} else {
|
||||
fail "redirect log file contents"
|
||||
diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
--- a/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp
|
||||
@@ -331,7 +331,7 @@ proc mi_cli_step {cli_output_re message} {
|
||||
|
||||
send_gdb "interpreter-exec console \"step\"\n"
|
||||
gdb_expect {
|
||||
- -re "\\^running\r\n\\*running,thread-id=\"all\"\r\n${mi_gdb_prompt}${cli_output_re}" {
|
||||
+ -re "\\^running\r\n\\*running,thread-id=\"1\"\r\n${mi_gdb_prompt}${cli_output_re}" {
|
||||
pass $message
|
||||
}
|
||||
timeout {
|
||||
|
||||
@ -22,4 +22,3 @@ diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3
|
||||
# The commands we test here produce many lines of output; disable "press
|
||||
# <return> to continue" prompts.
|
||||
gdb_test_no_output "set height 0"
|
||||
|
||||
|
||||
@ -1,15 +1,3 @@
|
||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128
|
||||
|
||||
2007-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/charsign.exp, gdb.base/charsign.c: New files.
|
||||
[ stripped ]
|
||||
|
||||
2007-10-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Port to GDB-6.7 - only the testcase left, patch has been reverted,
|
||||
char-vectors restricted.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/charsign.c b/gdb/testsuite/gdb.base/charsign.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -120,4 +108,3 @@ new file mode 100644
|
||||
+do_test {}
|
||||
+do_test {-fsigned-char}
|
||||
+do_test {-funsigned-char}
|
||||
|
||||
|
||||
@ -1,18 +1,3 @@
|
||||
2007-11-04 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to
|
||||
`powerpc*'.
|
||||
|
||||
Testcase for:
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
|
||||
|
||||
2007-10-21 Luis Machado <luisgpm@br.ibm.com>
|
||||
|
||||
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function.
|
||||
* (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as
|
||||
default dwarf2_frame_set_init_reg function.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -98,4 +83,3 @@ new file mode 100644
|
||||
+
|
||||
+gdb_test backtrace ".*operand0=<value optimized out>.*operand1=<value optimized out>.*" \
|
||||
+ "Check value of call clobbered registers"
|
||||
|
||||
|
||||
@ -1,22 +1,3 @@
|
||||
gdb/testsuite/gdb.base/fileio.c:
|
||||
gdb/testsuite/gdb.base/fileio.exp:
|
||||
2007-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/fileio.c (ROOTSUBDIR): New macro.
|
||||
(main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into
|
||||
ROOTSUBDIR if we are being run as root.
|
||||
* gdb.base/fileio.exp: Change the startup and finish cleanup.
|
||||
Change the test file reference to be into the `fileio.dir' directory.
|
||||
|
||||
sources/gdb/testsuite/gdb.base/dump.exp:
|
||||
Found on RHEL-5.s390x.
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp:
|
||||
random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
|
||||
|
||||
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
|
||||
frames-invalid can happen asynchronously.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
|
||||
--- a/gdb/testsuite/gdb.base/fileio.c
|
||||
+++ b/gdb/testsuite/gdb.base/fileio.c
|
||||
@ -94,4 +75,3 @@ diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.e
|
||||
|
||||
set timeout $oldtimeout
|
||||
return 0
|
||||
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
diff --git a/gdb/valops.c b/gdb/valops.c
|
||||
--- a/gdb/valops.c
|
||||
+++ b/gdb/valops.c
|
||||
@@ -1092,6 +1092,8 @@ value_assign (struct value *toval, struct value *fromval)
|
||||
struct gdbarch *gdbarch;
|
||||
int value_reg;
|
||||
|
||||
+ value_reg = VALUE_REGNUM (toval);
|
||||
+
|
||||
/* Figure out which frame this is in currently.
|
||||
|
||||
We use VALUE_FRAME_ID for obtaining the value's frame id instead of
|
||||
@@ -1101,8 +1103,14 @@ value_assign (struct value *toval, struct value *fromval)
|
||||
frame. */
|
||||
frame = frame_find_by_id (VALUE_FRAME_ID (toval));
|
||||
|
||||
- value_reg = VALUE_REGNUM (toval);
|
||||
-
|
||||
+ /* "set $reg+=1" should work on programs with no debug info,
|
||||
+ but frame_find_by_id returns NULL here (RH bug 436037).
|
||||
+ Use current frame, it represents CPU state in this case.
|
||||
+ If frame_find_by_id is changed to do it internally
|
||||
+ (it is contemplated there), remove this. */
|
||||
+ if (!frame)
|
||||
+ frame = get_current_frame ();
|
||||
+ /* Probably never happens. */
|
||||
if (!frame)
|
||||
error (_("Value being assigned to is no longer active."));
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
Test various forms of threads tracking across exec(2).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
--- a/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
|
||||
@ -171,4 +169,3 @@ diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.thr
|
||||
|
||||
gdb_test_multiple {} "Program exited" {
|
||||
-re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -471,4 +469,3 @@ new file mode 100644
|
||||
+
|
||||
+# `abort' can get expressed as `*__GI_abort'.
|
||||
+gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
|
||||
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
We may abort the process of detaching threads with multiple SIGINTs - which are
|
||||
being sent during a testcase terminating its child GDB.
|
||||
|
||||
Some of the threads may not be properly PTRACE_DETACHed which hurts if they
|
||||
should have been detached with SIGSTOP (as they are accidentally left running
|
||||
on the debugger termination).
|
||||
|
||||
diff --git a/gdb/defs.h b/gdb/defs.h
|
||||
--- a/gdb/defs.h
|
||||
+++ b/gdb/defs.h
|
||||
@ -22,7 +15,7 @@ diff --git a/gdb/defs.h b/gdb/defs.h
|
||||
diff --git a/gdb/extension.c b/gdb/extension.c
|
||||
--- a/gdb/extension.c
|
||||
+++ b/gdb/extension.c
|
||||
@@ -820,6 +820,11 @@ check_quit_flag (void)
|
||||
@@ -823,6 +823,11 @@ check_quit_flag (void)
|
||||
int i, result = 0;
|
||||
const struct extension_language_defn *extlang;
|
||||
|
||||
@ -37,7 +30,7 @@ diff --git a/gdb/extension.c b/gdb/extension.c
|
||||
diff --git a/gdb/top.c b/gdb/top.c
|
||||
--- a/gdb/top.c
|
||||
+++ b/gdb/top.c
|
||||
@@ -1626,7 +1626,13 @@ quit_force (int *exit_arg, int from_tty)
|
||||
@@ -1703,7 +1703,13 @@ quit_force (int *exit_arg, int from_tty)
|
||||
|
||||
qt.from_tty = from_tty;
|
||||
|
||||
@ -50,13 +43,13 @@ diff --git a/gdb/top.c b/gdb/top.c
|
||||
+#endif
|
||||
|
||||
/* Get out of tfind mode, and kill or detach all inferiors. */
|
||||
TRY
|
||||
try
|
||||
diff --git a/gdb/utils.c b/gdb/utils.c
|
||||
--- a/gdb/utils.c
|
||||
+++ b/gdb/utils.c
|
||||
@@ -100,6 +100,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
|
||||
@@ -102,6 +102,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
|
||||
|
||||
static int debug_timestamp = 0;
|
||||
static bool debug_timestamp = false;
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
+/* Nonzero means we are already processing the quitting cleanups and we should
|
||||
@ -65,7 +58,6 @@ diff --git a/gdb/utils.c b/gdb/utils.c
|
||||
+int quit_flag_cleanup;
|
||||
+#endif
|
||||
+
|
||||
/* Nonzero means that strings with character values >0x7F should be printed
|
||||
as octal escapes. Zero means just print the value (e.g. it's an
|
||||
/* True means that strings with character values >0x7F should be printed
|
||||
as octal escapes. False means just print the value (e.g. it's an
|
||||
international character, and the terminal or window can cope.) */
|
||||
|
||||
|
||||
Binary file not shown.
@ -1,6 +1,3 @@
|
||||
Archer-upstreamed:
|
||||
http://sourceware.org/ml/archer/2010-q2/msg00031.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -78,4 +75,3 @@ new file mode 100644
|
||||
+# Run to end. The buggy GDB failed instead with:
|
||||
+# Cannot access memory at address ADDR.
|
||||
+gdb_continue_to_end "" "continue" 1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -15441,6 +15441,50 @@ static struct cmd_list_element *enablebreaklist = NULL;
|
||||
@@ -15396,6 +15396,51 @@ static struct cmd_list_element *enablebreaklist = NULL;
|
||||
|
||||
cmd_list_element *commands_cmd_element = nullptr;
|
||||
|
||||
@ -45,17 +45,18 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
+ }
|
||||
+
|
||||
+ if (changed)
|
||||
+ qsort (bp_locations, bp_locations_count, sizeof (*bp_locations),
|
||||
+ bp_locations_compare);
|
||||
+ std::sort (bp_locations, bp_locations + bp_locations_count,
|
||||
+ bp_location_is_less_than);
|
||||
+}
|
||||
+
|
||||
+void _initialize_breakpoint (void);
|
||||
void
|
||||
_initialize_breakpoint (void)
|
||||
{
|
||||
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
|
||||
--- a/gdb/breakpoint.h
|
||||
+++ b/gdb/breakpoint.h
|
||||
@@ -1664,6 +1664,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
|
||||
@@ -1696,6 +1696,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
|
||||
UIOUT iff debugging multiple threads. */
|
||||
extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
|
||||
|
||||
@ -68,7 +69,7 @@ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
|
||||
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
||||
--- a/gdb/objfiles.c
|
||||
+++ b/gdb/objfiles.c
|
||||
@@ -875,6 +875,11 @@ objfile_relocate1 (struct objfile *objfile,
|
||||
@@ -816,6 +816,11 @@ objfile_relocate1 (struct objfile *objfile,
|
||||
obj_section_addr (s));
|
||||
}
|
||||
|
||||
@ -80,4 +81,15 @@ diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
||||
/* Data changed. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
diff --git a/gdb/value.c b/gdb/value.c
|
||||
--- a/gdb/value.c
|
||||
+++ b/gdb/value.c
|
||||
@@ -2840,7 +2840,7 @@ value_static_field (struct type *type, int fieldno)
|
||||
case FIELD_LOC_KIND_PHYSADDR:
|
||||
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
|
||||
TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
|
||||
- + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
|
||||
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
|
||||
break;
|
||||
case FIELD_LOC_KIND_PHYSNAME:
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
--- a/gdb/gdbtypes.h
|
||||
+++ b/gdb/gdbtypes.h
|
||||
@@ -507,6 +507,7 @@ enum field_loc_kind
|
||||
@@ -516,6 +516,7 @@ enum field_loc_kind
|
||||
{
|
||||
FIELD_LOC_KIND_BITPOS, /**< bitpos */
|
||||
FIELD_LOC_KIND_ENUMVAL, /**< enumval */
|
||||
@ -9,7 +9,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
|
||||
FIELD_LOC_KIND_PHYSNAME, /**< physname */
|
||||
FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
|
||||
@@ -558,6 +559,7 @@ union field_location
|
||||
@@ -566,6 +567,7 @@ union field_location
|
||||
field. Otherwise, physname is the mangled label of the
|
||||
static field. */
|
||||
|
||||
@ -17,7 +17,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
CORE_ADDR physaddr;
|
||||
const char *physname;
|
||||
|
||||
@@ -1436,6 +1438,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
@@ -1474,6 +1476,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
|
||||
#define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
|
||||
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
|
||||
@ -25,7 +25,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
|
||||
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
|
||||
#define SET_FIELD_BITPOS(thisfld, bitpos) \
|
||||
@@ -1447,6 +1450,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
@@ -1485,6 +1488,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define SET_FIELD_PHYSNAME(thisfld, name) \
|
||||
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
|
||||
FIELD_STATIC_PHYSNAME (thisfld) = (name))
|
||||
@ -33,7 +33,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
#define SET_FIELD_PHYSADDR(thisfld, addr) \
|
||||
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
|
||||
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
|
||||
@@ -1463,6 +1467,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
@@ -1501,6 +1505,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
|
||||
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
|
||||
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
|
||||
@ -44,14 +44,13 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||
diff --git a/gdb/value.c b/gdb/value.c
|
||||
--- a/gdb/value.c
|
||||
+++ b/gdb/value.c
|
||||
@@ -2827,7 +2827,8 @@ value_static_field (struct type *type, int fieldno)
|
||||
@@ -2839,7 +2839,8 @@ value_static_field (struct type *type, int fieldno)
|
||||
{
|
||||
case FIELD_LOC_KIND_PHYSADDR:
|
||||
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
|
||||
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
|
||||
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
|
||||
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
|
||||
+ + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))]));
|
||||
break;
|
||||
case FIELD_LOC_KIND_PHYSNAME:
|
||||
{
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp
|
||||
--- a/gdb/testsuite/gdb.ada/packed_array.exp
|
||||
+++ b/gdb/testsuite/gdb.ada/packed_array.exp
|
||||
@@ -56,5 +56,11 @@ gdb_test_multiple "$test" "$test" {
|
||||
@@ -53,5 +53,11 @@ gdb_test_multiple "$test" "$test" {
|
||||
# are. Observed with (FSF GNU Ada 4.5.3 20110124).
|
||||
xfail $test
|
||||
}
|
||||
@ -2797,7 +2797,7 @@ new file mode 100644
|
||||
+gdb_breakpoint [gdb_get_line_number "varx-allocated"]
|
||||
+gdb_continue_to_breakpoint "varx-allocated"
|
||||
+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
|
||||
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
|
||||
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx allocated"
|
||||
+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
|
||||
+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
|
||||
+
|
||||
@ -2824,7 +2824,7 @@ new file mode 100644
|
||||
+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
|
||||
+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
|
||||
+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
|
||||
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
|
||||
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx with varv associated"
|
||||
+# Intel Fortran Compiler 10.1.008 uses the pointer type.
|
||||
+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
|
||||
+
|
||||
@ -2845,7 +2845,7 @@ new file mode 100644
|
||||
+gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
|
||||
+gdb_continue_to_breakpoint "varx-deallocated"
|
||||
+gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx deallocated"
|
||||
+gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx deallocated"
|
||||
+gdb_test "ptype varx" {type = real\(kind=4\), allocatable \(:,:,:\)} "ptype varx deallocated"
|
||||
+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
|
||||
+gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) deallocated"
|
||||
+gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) deallocated"
|
||||
@ -3683,7 +3683,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
--- a/gdb/testsuite/lib/gdb.exp
|
||||
+++ b/gdb/testsuite/lib/gdb.exp
|
||||
@@ -170,6 +170,11 @@ proc gdb_unload {} {
|
||||
send_gdb "y\n"
|
||||
send_gdb "y\n" answer
|
||||
exp_continue
|
||||
}
|
||||
+ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
|
||||
@ -3692,7 +3692,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
+ exp_continue
|
||||
+ }
|
||||
-re "Discard symbol table from .*y or n.*$" {
|
||||
send_gdb "y\n"
|
||||
send_gdb "y\n" answer
|
||||
exp_continue
|
||||
diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
|
||||
--- a/gdb/testsuite/lib/pascal.exp
|
||||
@ -3728,4 +3728,3 @@ diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp
|
||||
}
|
||||
set pascal_init_done 1
|
||||
}
|
||||
|
||||
|
||||
432
gdb-archer.patch
432
gdb-archer.patch
@ -1,27 +1,3 @@
|
||||
http://sourceware.org/gdb/wiki/ProjectArcher
|
||||
http://sourceware.org/gdb/wiki/ArcherBranchManagement
|
||||
|
||||
GIT snapshot:
|
||||
commit 718a1618b2f691a7f407213bb50f100ac59f91c3
|
||||
|
||||
tromey/python
|
||||
|
||||
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
--- a/gdb/Makefile.in
|
||||
+++ b/gdb/Makefile.in
|
||||
@@ -2082,6 +2082,12 @@ stamp-h: $(srcdir)/config.in config.status
|
||||
CONFIG_LINKS= \
|
||||
$(SHELL) config.status
|
||||
|
||||
+.gdbinit: $(srcdir)/gdbinit.in config.status
|
||||
+ CONFIG_FILES=".gdbinit:gdbinit.in" \
|
||||
+ CONFIG_COMMANDS= \
|
||||
+ CONFIG_HEADERS= \
|
||||
+ $(SHELL) config.status
|
||||
+
|
||||
config.status: $(srcdir)/configure configure.nat configure.tgt configure.host ../bfd/development.sh
|
||||
$(SHELL) config.status --recheck
|
||||
|
||||
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
|
||||
--- a/gdb/data-directory/Makefile.in
|
||||
+++ b/gdb/data-directory/Makefile.in
|
||||
@ -33,47 +9,14 @@ diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
|
||||
gdb/command/explore.py \
|
||||
gdb/command/backtrace.py \
|
||||
gdb/command/frame_filters.py \
|
||||
@@ -92,6 +93,8 @@ PYTHON_FILE_LIST = \
|
||||
@@ -92,6 +93,7 @@ PYTHON_FILE_LIST = \
|
||||
gdb/function/as_string.py \
|
||||
gdb/function/caller_is.py \
|
||||
gdb/function/strfns.py \
|
||||
+ gdb/function/caller_is.py \
|
||||
+ gdb/function/in_scope.py \
|
||||
gdb/printer/__init__.py \
|
||||
gdb/printer/bound_registers.py
|
||||
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -1251,6 +1251,16 @@ for remote debugging.
|
||||
Run using @var{device} for your program's standard input and output.
|
||||
@c FIXME: kingdon thinks there is more to -tty. Investigate.
|
||||
|
||||
+@item -P
|
||||
+@cindex @code{-P}
|
||||
+@itemx --python
|
||||
+@cindex @code{--python}
|
||||
+Change interpretation of command line so that the argument immediately
|
||||
+following this switch is taken to be the name of a Python script file.
|
||||
+This option stops option processing; subsequent options are passed to
|
||||
+Python as @code{sys.argv}. This option is only available if Python
|
||||
+scripting support was enabled when @value{GDBN} was configured.
|
||||
+
|
||||
@c resolve the situation of these eventually
|
||||
@item -tui
|
||||
@cindex @code{--tui}
|
||||
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
|
||||
--- a/gdb/doc/python.texi
|
||||
+++ b/gdb/doc/python.texi
|
||||
@@ -90,8 +90,6 @@ containing @code{end}. For example:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) python
|
||||
-Type python script
|
||||
-End with a line saying just "end".
|
||||
>print 23
|
||||
>end
|
||||
23
|
||||
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
|
||||
--- a/gdb/gdb-gdb.gdb.in
|
||||
+++ b/gdb/gdb-gdb.gdb.in
|
||||
@ -93,173 +36,6 @@ diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
|
||||
if !$gdb_init_done
|
||||
set variable $gdb_init_done = 1
|
||||
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "interps.h"
|
||||
#include "main.h"
|
||||
+#include "python/python.h"
|
||||
#include "source.h"
|
||||
#include "cli/cli-cmds.h"
|
||||
#include "objfiles.h"
|
||||
@@ -478,7 +479,7 @@ exec_or_core_file_attach (const char *filename, int from_tty)
|
||||
}
|
||||
|
||||
static void
|
||||
-captured_main_1 (struct captured_main_args *context)
|
||||
+captured_main_1 (struct captured_main_args *context, int &python_script)
|
||||
{
|
||||
int argc = context->argc;
|
||||
char **argv = context->argv;
|
||||
@@ -698,10 +699,14 @@ captured_main_1 (struct captured_main_args *context)
|
||||
{"args", no_argument, &set_args, 1},
|
||||
{"l", required_argument, 0, 'l'},
|
||||
{"return-child-result", no_argument, &return_child_result, 1},
|
||||
+#if HAVE_PYTHON
|
||||
+ {"python", no_argument, 0, 'P'},
|
||||
+ {"P", no_argument, 0, 'P'},
|
||||
+#endif
|
||||
{0, no_argument, 0, 0}
|
||||
};
|
||||
|
||||
- while (1)
|
||||
+ while (!python_script)
|
||||
{
|
||||
int option_index;
|
||||
|
||||
@@ -719,6 +724,9 @@ captured_main_1 (struct captured_main_args *context)
|
||||
case 0:
|
||||
/* Long option that just sets a flag. */
|
||||
break;
|
||||
+ case 'P':
|
||||
+ python_script = 1;
|
||||
+ break;
|
||||
case OPT_SE:
|
||||
symarg = optarg;
|
||||
execarg = optarg;
|
||||
@@ -898,7 +906,31 @@ captured_main_1 (struct captured_main_args *context)
|
||||
|
||||
/* Now that gdb_init has created the initial inferior, we're in
|
||||
position to set args for that inferior. */
|
||||
- if (set_args)
|
||||
+ if (python_script)
|
||||
+ {
|
||||
+ /* The first argument is a python script to evaluate, and
|
||||
+ subsequent arguments are passed to the script for
|
||||
+ processing there. */
|
||||
+ if (optind >= argc)
|
||||
+ {
|
||||
+ fprintf_unfiltered (gdb_stderr,
|
||||
+ _("%s: Python script file name required\n"),
|
||||
+ argv[0]);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+ /* FIXME: should handle inferior I/O intelligently here.
|
||||
+ E.g., should be possible to run gdb in pipeline and have
|
||||
+ Python (and gdb) output go to stderr or file; and if a
|
||||
+ prompt is needed, open the tty. */
|
||||
+ quiet = 1;
|
||||
+ /* FIXME: should read .gdbinit if, and only if, a prompt is
|
||||
+ requested by the script. Though... maybe this is not
|
||||
+ ideal? */
|
||||
+ /* FIXME: likewise, reading in history. */
|
||||
+ inhibit_gdbinit = 1;
|
||||
+ }
|
||||
+ else if (set_args)
|
||||
{
|
||||
/* The remaining options are the command-line options for the
|
||||
inferior. The first one is the sym/exec file, and the rest
|
||||
@@ -1199,7 +1231,8 @@ captured_main_1 (struct captured_main_args *context)
|
||||
|
||||
/* Read in the old history after all the command files have been
|
||||
read. */
|
||||
- init_history ();
|
||||
+ if (!python_script)
|
||||
+ init_history ();
|
||||
|
||||
if (batch_flag)
|
||||
{
|
||||
@@ -1215,24 +1248,37 @@ static void
|
||||
captured_main (void *data)
|
||||
{
|
||||
struct captured_main_args *context = (struct captured_main_args *) data;
|
||||
+ int python_script = 0;
|
||||
|
||||
- captured_main_1 (context);
|
||||
+ captured_main_1 (context, python_script);
|
||||
|
||||
- /* NOTE: cagney/1999-11-07: There is probably no reason for not
|
||||
- moving this loop and the code found in captured_command_loop()
|
||||
- into the command_loop() proper. The main thing holding back that
|
||||
- change - SET_TOP_LEVEL() - has been eliminated. */
|
||||
- while (1)
|
||||
+#if HAVE_PYTHON
|
||||
+ if (python_script)
|
||||
{
|
||||
- TRY
|
||||
- {
|
||||
- captured_command_loop ();
|
||||
- }
|
||||
- CATCH (ex, RETURN_MASK_ALL)
|
||||
+ extern int pagination_enabled;
|
||||
+ pagination_enabled = 0;
|
||||
+ run_python_script (context->argc - optind, &context->argv[optind]);
|
||||
+ return;
|
||||
+ }
|
||||
+ else
|
||||
+#endif
|
||||
+ {
|
||||
+ /* NOTE: cagney/1999-11-07: There is probably no reason for not
|
||||
+ moving this loop and the code found in captured_command_loop()
|
||||
+ into the command_loop() proper. The main thing holding back that
|
||||
+ change - SET_TOP_LEVEL() - has been eliminated. */
|
||||
+ while (1)
|
||||
{
|
||||
- exception_print (gdb_stderr, ex);
|
||||
+ TRY
|
||||
+ {
|
||||
+ captured_command_loop ();
|
||||
+ }
|
||||
+ CATCH (ex, RETURN_MASK_ALL)
|
||||
+ {
|
||||
+ exception_print (gdb_stderr, ex);
|
||||
+ }
|
||||
+ END_CATCH
|
||||
}
|
||||
- END_CATCH
|
||||
}
|
||||
/* No exit -- exit is through quit_command. */
|
||||
}
|
||||
@@ -1275,6 +1321,12 @@ print_gdb_help (struct ui_file *stream)
|
||||
fputs_unfiltered (_("\
|
||||
This is the GNU debugger. Usage:\n\n\
|
||||
gdb [options] [executable-file [core-file or process-id]]\n\
|
||||
+ gdb [options] --args executable-file [inferior-arguments ...]\n"), stream);
|
||||
+#if HAVE_PYTHON
|
||||
+ fputs_unfiltered (_("\
|
||||
+ gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream);
|
||||
+#endif
|
||||
+ fputs_unfiltered (_("\n\
|
||||
gdb [options] --args executable-file [inferior-arguments ...]\n\n\
|
||||
"), stream);
|
||||
fputs_unfiltered (_("\
|
||||
@@ -1320,6 +1372,13 @@ Output and user interface control:\n\n\
|
||||
#endif
|
||||
fputs_unfiltered (_("\
|
||||
--dbx DBX compatibility mode.\n\
|
||||
+"), stream);
|
||||
+#if HAVE_PYTHON
|
||||
+ fputs_unfiltered (_("\
|
||||
+ --python, -P Following argument is Python script file; remaining\n\
|
||||
+ arguments are passed to script.\n"), stream);
|
||||
+#endif
|
||||
+ fputs_unfiltered (_("\
|
||||
-q, --quiet, --silent\n\
|
||||
Do not print version number on startup.\n\n\
|
||||
"), stream);
|
||||
diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -354,177 +130,6 @@ new file mode 100644
|
||||
+ return wanted == found
|
||||
+
|
||||
+InScope ()
|
||||
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
|
||||
--- a/gdb/python/python-internal.h
|
||||
+++ b/gdb/python/python-internal.h
|
||||
@@ -709,6 +709,9 @@ private:
|
||||
PyThreadState *m_save;
|
||||
};
|
||||
|
||||
+struct cleanup *ensure_python_env (struct gdbarch *gdbarch,
|
||||
+ const struct language_defn *language);
|
||||
+
|
||||
extern struct gdbarch *python_gdbarch;
|
||||
extern const struct language_defn *python_language;
|
||||
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -94,6 +94,8 @@ const struct extension_language_defn extension_language_python =
|
||||
#include "linespec.h"
|
||||
#include "source.h"
|
||||
#include "common/version.h"
|
||||
+#include "inferior.h"
|
||||
+#include "gdbthread.h"
|
||||
#include "target.h"
|
||||
#include "gdbthread.h"
|
||||
#include "interps.h"
|
||||
@@ -235,6 +237,29 @@ gdbpy_enter::~gdbpy_enter ()
|
||||
restore_active_ext_lang (m_previous_active);
|
||||
}
|
||||
|
||||
+static void
|
||||
+restore_python_env (void *p)
|
||||
+{
|
||||
+ gdbpy_enter *env = (gdbpy_enter *) p;
|
||||
+
|
||||
+ delete env;
|
||||
+}
|
||||
+
|
||||
+/* Called before entering the Python interpreter to install the
|
||||
+ current language and architecture to be used for Python values.
|
||||
+ Also set the active extension language for GDB so that SIGINT's
|
||||
+ are directed our way, and if necessary install the right SIGINT
|
||||
+ handler. */
|
||||
+
|
||||
+struct cleanup *
|
||||
+ensure_python_env (struct gdbarch *gdbarch,
|
||||
+ const struct language_defn *language)
|
||||
+{
|
||||
+ gdbpy_enter *env = new gdbpy_enter (gdbarch, language);
|
||||
+
|
||||
+ return make_cleanup (restore_python_env, env);
|
||||
+}
|
||||
+
|
||||
/* Set the quit flag. */
|
||||
|
||||
static void
|
||||
@@ -1283,6 +1308,92 @@ gdbpy_print_stack_or_quit ()
|
||||
|
||||
|
||||
|
||||
+/* True if 'gdb -P' was used, false otherwise. */
|
||||
+static int running_python_script;
|
||||
+
|
||||
+/* True if we are currently in a call to 'gdb.cli', false otherwise. */
|
||||
+static int in_cli;
|
||||
+
|
||||
+/* Enter the command loop. */
|
||||
+
|
||||
+static PyObject *
|
||||
+gdbpy_cli (PyObject *unused1, PyObject *unused2)
|
||||
+{
|
||||
+ if (! running_python_script || in_cli)
|
||||
+ return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively");
|
||||
+
|
||||
+ if (current_uiout->is_mi_like_p ())
|
||||
+ return PyErr_Format (PyExc_RuntimeError, _("Cannot invoke CLI from MI."));
|
||||
+
|
||||
+ in_cli = 1;
|
||||
+ /* See captured_command_loop. */
|
||||
+
|
||||
+ /* Give the interpreter a chance to print a prompt. */
|
||||
+ interp_pre_command_loop (top_level_interpreter ());
|
||||
+
|
||||
+ /* Now it's time to start the event loop. */
|
||||
+ start_event_loop ();
|
||||
+
|
||||
+ in_cli = 0;
|
||||
+
|
||||
+ Py_RETURN_NONE;
|
||||
+}
|
||||
+
|
||||
+/* Set up the Python argument vector and evaluate a script. This is
|
||||
+ used to implement 'gdb -P'. */
|
||||
+
|
||||
+void
|
||||
+run_python_script (int argc, char **argv)
|
||||
+{
|
||||
+ FILE *input;
|
||||
+
|
||||
+ /* We never free this, since we plan to exit at the end. */
|
||||
+ ensure_python_env (get_current_arch (), current_language);
|
||||
+
|
||||
+ running_python_script = 1;
|
||||
+
|
||||
+#if PYTHON_ABI_VERSION < 3
|
||||
+ PySys_SetArgv (argc - 1, argv + 1);
|
||||
+#else
|
||||
+ {
|
||||
+ wchar_t **wargv = (wchar_t **) alloca (sizeof (*wargv) * (argc + 1));
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 1; i < argc; i++)
|
||||
+ {
|
||||
+ size_t len = mbstowcs (NULL, argv[i], 0);
|
||||
+ /* Python-related GDB sources are built with -DNDEBUG
|
||||
+ https://sourceware.org/bugzilla/show_bug.cgi?id=20445 */
|
||||
+ size_t len2 ATTRIBUTE_UNUSED;
|
||||
+
|
||||
+ if (len == (size_t) -1)
|
||||
+ {
|
||||
+ fprintf (stderr, "Invalid multibyte argument #%d \"%s\"\n",
|
||||
+ i, argv[i]);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ wargv[i] = (wchar_t *) alloca (sizeof (**wargv) * (len + 1));
|
||||
+ len2 = mbstowcs (wargv[i], argv[i], len + 1);
|
||||
+ assert (len2 == len);
|
||||
+ }
|
||||
+ wargv[argc] = NULL;
|
||||
+ PySys_SetArgv (argc - 1, wargv + 1);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ input = fopen (argv[0], "r");
|
||||
+ if (! input)
|
||||
+ {
|
||||
+ fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno));
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ PyRun_SimpleFile (input, argv[0]);
|
||||
+ fclose (input);
|
||||
+ exit (0);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
/* Return a sequence holding all the Progspaces. */
|
||||
|
||||
static PyObject *
|
||||
@@ -1937,6 +2048,8 @@ PyMethodDef python_GdbMethods[] =
|
||||
Evaluate command, a string, as a gdb CLI command. Optionally returns\n\
|
||||
a Python String containing the output of the command if to_string is\n\
|
||||
set to True." },
|
||||
+ { "cli", gdbpy_cli, METH_NOARGS,
|
||||
+ "Enter the gdb CLI" },
|
||||
{ "parameter", gdbpy_parameter, METH_VARARGS,
|
||||
"Return a gdb parameter's value" },
|
||||
|
||||
diff --git a/gdb/python/python.h b/gdb/python/python.h
|
||||
--- a/gdb/python/python.h
|
||||
+++ b/gdb/python/python.h
|
||||
@@ -25,7 +25,10 @@
|
||||
/* This is all that python exports to gdb. */
|
||||
extern const struct extension_language_defn extension_language_python;
|
||||
|
||||
+
|
||||
/* Command element for the 'python' command. */
|
||||
extern cmd_list_element *python_cmd_element;
|
||||
|
||||
+extern void run_python_script (int argc, char **argv);
|
||||
+
|
||||
#endif /* PYTHON_PYTHON_H */
|
||||
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
|
||||
--- a/gdb/testsuite/gdb.python/py-frame.exp
|
||||
+++ b/gdb/testsuite/gdb.python/py-frame.exp
|
||||
@ -540,7 +145,7 @@ diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py
|
||||
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
|
||||
--- a/gdb/testsuite/gdb.python/py-value.exp
|
||||
+++ b/gdb/testsuite/gdb.python/py-value.exp
|
||||
@@ -399,6 +399,15 @@ proc test_value_after_death {} {
|
||||
@@ -419,6 +419,15 @@ proc test_value_after_death {} {
|
||||
"print value's type"
|
||||
}
|
||||
|
||||
@ -556,7 +161,7 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py
|
||||
# Regression test for invalid subscript operations. The bug was that
|
||||
# the type of the value was not being checked before allowing a
|
||||
# subscript operation to proceed.
|
||||
@@ -585,6 +594,7 @@ test_value_in_inferior
|
||||
@@ -606,6 +615,7 @@ test_value_in_inferior
|
||||
test_value_from_buffer
|
||||
test_inferior_function_call
|
||||
test_value_after_death
|
||||
@ -564,34 +169,3 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py
|
||||
|
||||
# Test either C or C++ values.
|
||||
|
||||
diff --git a/gdb/varobj.c b/gdb/varobj.c
|
||||
--- a/gdb/varobj.c
|
||||
+++ b/gdb/varobj.c
|
||||
@@ -217,6 +217,14 @@ is_root_p (const struct varobj *var)
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
+/* Helper function to install a Python environment suitable for
|
||||
+ use during operations on VAR. */
|
||||
+struct cleanup *
|
||||
+varobj_ensure_python_env (const struct varobj *var)
|
||||
+{
|
||||
+ return ensure_python_env (var->root->exp->gdbarch,
|
||||
+ var->root->exp->language_defn);
|
||||
+}
|
||||
|
||||
/* See python-internal.h. */
|
||||
gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var)
|
||||
diff --git a/gdb/varobj.h b/gdb/varobj.h
|
||||
--- a/gdb/varobj.h
|
||||
+++ b/gdb/varobj.h
|
||||
@@ -328,6 +328,8 @@ extern bool varobj_has_more (const struct varobj *var, int to);
|
||||
|
||||
extern bool varobj_is_dynamic_p (const struct varobj *var);
|
||||
|
||||
+extern struct cleanup *varobj_ensure_python_env (const struct varobj *var);
|
||||
+
|
||||
extern bool varobj_default_value_is_changeable_p (const struct varobj *var);
|
||||
extern bool varobj_value_is_changeable_p (const struct varobj *var);
|
||||
|
||||
|
||||
|
||||
@ -1,43 +1,7 @@
|
||||
http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html
|
||||
|
||||
Hi,
|
||||
|
||||
and here is the last bit for new SELinux 'deny_ptrace':
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=786878
|
||||
|
||||
As even PTRACE_TRACEME fails in such case it needs to install hook for even
|
||||
that event.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/
|
||||
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include
|
||||
selinux/selinux.h.
|
||||
(linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings.
|
||||
(linux_ptrace_create_warnings): New.
|
||||
* common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration.
|
||||
* config.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* configure.ac: Check selinux/selinux.h and the selinux library.
|
||||
* inf-ptrace.c (inf_ptrace_me): Check the ptrace result.
|
||||
* linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap
|
||||
to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings.
|
||||
|
||||
gdb/gdbserver/
|
||||
* config.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* configure.ac: Check selinux/selinux.h and the selinux library.
|
||||
* linux-low.c (linux_traceme): New function.
|
||||
(linux_create_inferior, linux_tracefork_child): Call it instead of
|
||||
direct ptrace.
|
||||
|
||||
diff --git a/gdb/config.in b/gdb/config.in
|
||||
--- a/gdb/config.in
|
||||
+++ b/gdb/config.in
|
||||
@@ -267,6 +267,9 @@
|
||||
@@ -251,6 +251,9 @@
|
||||
/* Define if librpm library is being used. */
|
||||
#undef HAVE_LIBRPM
|
||||
|
||||
@ -47,7 +11,7 @@ diff --git a/gdb/config.in b/gdb/config.in
|
||||
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
|
||||
#undef HAVE_LIBUNWIND_IA64_H
|
||||
|
||||
@@ -390,6 +393,9 @@
|
||||
@@ -386,6 +389,9 @@
|
||||
/* Define to 1 if you have the `scm_new_smob' function. */
|
||||
#undef HAVE_SCM_NEW_SMOB
|
||||
|
||||
@ -60,7 +24,7 @@ diff --git a/gdb/config.in b/gdb/config.in
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -15898,6 +15898,64 @@ cat >>confdefs.h <<_ACEOF
|
||||
@@ -16434,6 +16434,64 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
@ -128,7 +92,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -2051,6 +2051,10 @@ case $host_os in
|
||||
@@ -1964,6 +1964,10 @@ case $host_os in
|
||||
esac
|
||||
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
|
||||
|
||||
@ -142,9 +106,9 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
|
||||
--- a/gdb/gdbserver/config.in
|
||||
+++ b/gdb/gdbserver/config.in
|
||||
@@ -126,6 +126,9 @@
|
||||
/* Define to 1 if you have the `mcheck' library (-lmcheck). */
|
||||
#undef HAVE_LIBMCHECK
|
||||
@@ -125,6 +125,9 @@
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
+/* Define to 1 if you have the `selinux' library (-lselinux). */
|
||||
+#undef HAVE_LIBSELINUX
|
||||
@ -152,7 +116,7 @@ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
|
||||
/* Define if the target supports branch tracing. */
|
||||
#undef HAVE_LINUX_BTRACE
|
||||
|
||||
@@ -202,6 +205,9 @@
|
||||
@@ -210,6 +213,9 @@
|
||||
/* Define to 1 if you have the `pwrite' function. */
|
||||
#undef HAVE_PWRITE
|
||||
|
||||
@ -165,7 +129,7 @@ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
|
||||
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
|
||||
--- a/gdb/gdbserver/configure
|
||||
+++ b/gdb/gdbserver/configure
|
||||
@@ -8589,6 +8589,64 @@ if $want_ipa ; then
|
||||
@@ -9398,6 +9398,64 @@ if $want_ipa ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -233,7 +197,7 @@ diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
|
||||
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
|
||||
--- a/gdb/gdbserver/configure.ac
|
||||
+++ b/gdb/gdbserver/configure.ac
|
||||
@@ -478,6 +478,10 @@ if $want_ipa ; then
|
||||
@@ -465,6 +465,10 @@ if $want_ipa ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -247,7 +211,7 @@ diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
|
||||
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
|
||||
--- a/gdb/gdbserver/linux-low.c
|
||||
+++ b/gdb/gdbserver/linux-low.c
|
||||
@@ -967,7 +967,16 @@ linux_ptrace_fun ()
|
||||
@@ -968,7 +968,16 @@ linux_ptrace_fun ()
|
||||
{
|
||||
if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
|
||||
(PTRACE_TYPE_ARG4) 0) < 0)
|
||||
@ -268,22 +232,21 @@ diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -1099,7 +1099,17 @@ linux_nat_target::create_inferior (const char *exec_file,
|
||||
@@ -1092,7 +1092,16 @@ linux_nat_target::create_inferior (const char *exec_file,
|
||||
/* Make sure we report all signals during startup. */
|
||||
pass_signals ({});
|
||||
|
||||
- inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
|
||||
+ TRY
|
||||
+ try
|
||||
+ {
|
||||
+ inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
|
||||
+ }
|
||||
+ CATCH (ex, RETURN_MASK_ERROR)
|
||||
+ catch (const gdb_exception_error &ex)
|
||||
+ {
|
||||
+ std::string result = linux_ptrace_create_warnings ();
|
||||
+
|
||||
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message);
|
||||
+ throw_error (ex.error, "%s%s", result.c_str (), ex.message->c_str ());
|
||||
+ }
|
||||
+ END_CATCH
|
||||
}
|
||||
|
||||
/* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not
|
||||
@ -347,4 +310,3 @@ diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
|
||||
extern void linux_check_ptrace_features (void);
|
||||
extern void linux_enable_event_reporting (pid_t pid, int attached);
|
||||
extern void linux_disable_event_reporting (pid_t pid);
|
||||
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
This should fix the error with glib. An error message will still be
|
||||
printed, but a default backtrace will occur in this case.
|
||||
|
||||
--
|
||||
|
||||
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
|
||||
--- a/gdb/python/py-framefilter.c
|
||||
+++ b/gdb/python/py-framefilter.c
|
||||
@@ -1139,6 +1139,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
@@ -1204,6 +1204,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
htab_eq_pointer,
|
||||
NULL));
|
||||
|
||||
@ -14,7 +9,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
|
||||
while (true)
|
||||
{
|
||||
gdbpy_ref<> item (PyIter_Next (iterable.get ()));
|
||||
@@ -1147,8 +1148,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
@@ -1212,8 +1213,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
{
|
||||
if (PyErr_Occurred ())
|
||||
{
|
||||
@ -25,7 +20,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1181,7 +1182,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
@@ -1245,7 +1246,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
|
||||
/* Do not exit on error printing a single frame. Print the
|
||||
error and continue with other frames. */
|
||||
if (success == EXT_LANG_BT_ERROR)
|
||||
@ -35,4 +30,3 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
|
||||
@ -1,78 +1,7 @@
|
||||
http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html
|
||||
|
||||
Hi,
|
||||
|
||||
in some cases with deleted main executable GDB will want to kill the inferior.
|
||||
|
||||
$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$!
|
||||
$ rm /tmp/sleep
|
||||
$ gdb /tmp/sleep $p
|
||||
GNU gdb (GDB) 7.10.50.20151016-cvs
|
||||
/tmp/sleep: No such file or directory.
|
||||
Attaching to process 9694
|
||||
/tmp/sleep (deleted): No such file or directory.
|
||||
A program is being debugged already. Kill it? (y or n) _
|
||||
|
||||
The first attachment of "/tmp/sleep" commandline argument errors at:
|
||||
|
||||
267 if (scratch_chan < 0)
|
||||
268 perror_with_name (filename);
|
||||
1051 if (catch_command_errors_const (exec_file_attach, execarg,
|
||||
1052 !batch_flag))
|
||||
|
||||
Then GDB tries to attach to the process $p:
|
||||
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
|
||||
This succeeds and since this moment GDB has a valid inferior. But despite that
|
||||
the lines
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
still fail because consequently attach_command() fails to find the associated
|
||||
executable file:
|
||||
|
||||
267 if (scratch_chan < 0)
|
||||
268 perror_with_name (filename);
|
||||
1082 if (catch_command_errors (attach_command, pid_or_core_arg,
|
||||
1083 !batch_flag) == 0)
|
||||
|
||||
and therefore GDB executes the following:
|
||||
|
||||
(gdb) bt
|
||||
2179 if (have_inferiors ())
|
||||
2180 {
|
||||
2181 if (!from_tty
|
||||
2182 || !have_live_inferiors ()
|
||||
2183 || query (_("A program is being debugged already. Kill it? ")))
|
||||
2184 iterate_over_inferiors (dispose_inferior, NULL);
|
||||
2185 else
|
||||
2186 error (_("Program not killed."));
|
||||
2187 }
|
||||
1084 catch_command_errors (core_file_command, pid_or_core_arg,
|
||||
1085 !batch_flag);
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/ChangeLog
|
||||
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* main.c (captured_main): Run core_file_command for pid_or_core_arg
|
||||
only if not have_inferiors ().
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2015-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/attach-kills.c: New.
|
||||
* gdb.base/attach-kills.exp: New.
|
||||
|
||||
diff --git a/gdb/main.c b/gdb/main.c
|
||||
--- a/gdb/main.c
|
||||
+++ b/gdb/main.c
|
||||
@@ -1129,7 +1129,10 @@ captured_main_1 (struct captured_main_args *context)
|
||||
@@ -1148,7 +1148,10 @@ captured_main_1 (struct captured_main_args *context)
|
||||
{
|
||||
ret = catch_command_errors (attach_command, pid_or_core_arg,
|
||||
!batch_flag);
|
||||
@ -168,4 +97,3 @@ new file mode 100644
|
||||
+}
|
||||
+
|
||||
+kill_wait_spawned_process $test_spawn_id
|
||||
|
||||
|
||||
@ -1,28 +1,7 @@
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
|
||||
|
||||
I find it a bug in DWARF and gdb behaves correctly according to it. From the
|
||||
current DWARF's point of view the is a function call which you skip by "next".
|
||||
|
||||
If you hide any /usr/lib/debug such as using:
|
||||
gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
|
||||
and use "step" command instead of "next" there it will work.
|
||||
(You need to hide debuginfo from libgomp as you would step into libgomp sources
|
||||
to maintain the threads for execution.)
|
||||
|
||||
There should be some DWARF extension for it, currently tried to detect
|
||||
substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
|
||||
consider such sub-function as a skippable by "next".
|
||||
|
||||
Another problem is that with "set scheduler-locking" being "off" (default
|
||||
upstream) or "step" (default in F/RHEL) the simultaneous execution of the
|
||||
threads is inconvenient. Setting it to "on" will lockup the debugging as the
|
||||
threads need to get synchronized at some point. This is a more general
|
||||
debugging problem of GOMP outside of the scope of this Bug.
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -6499,6 +6499,16 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
@@ -6453,6 +6453,16 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
|
||||
if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL)
|
||||
{
|
||||
@ -30,16 +9,16 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
+ struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc).minsym;
|
||||
+
|
||||
+ if ((stop_fn == NULL
|
||||
+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
|
||||
+ || strstr (stop_fn->linkage_name (), ".omp_fn.") == NULL)
|
||||
+ /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */
|
||||
+ && (stopf == NULL
|
||||
+ || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL))
|
||||
+ || strstr (stopf->linkage_name (), "._omp_fn.") == NULL))
|
||||
+{ /* ".omp_fn." */
|
||||
+
|
||||
/* We're doing a "next".
|
||||
|
||||
Normal (forward) execution: set a breakpoint at the
|
||||
@@ -6532,6 +6542,7 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
@@ -6486,6 +6496,7 @@ process_event_stop_test (struct execution_control_state *ecs)
|
||||
|
||||
keep_going (ecs);
|
||||
return;
|
||||
@ -120,4 +99,3 @@ new file mode 100644
|
||||
+ end do
|
||||
+ print *, "success"
|
||||
+ end
|
||||
|
||||
|
||||
@ -1,167 +0,0 @@
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -8773,7 +8773,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
|
||||
int enabled, int internal, unsigned flags,
|
||||
int display_canonical)
|
||||
{
|
||||
- int i;
|
||||
+ int i ATTRIBUTE_UNUSED;
|
||||
|
||||
if (type == bp_hardware_breakpoint)
|
||||
{
|
||||
@@ -14271,7 +14271,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
|
||||
|
||||
if (bpt->type == bp_hardware_breakpoint)
|
||||
{
|
||||
- int i;
|
||||
+ int i ATTRIBUTE_UNUSED;
|
||||
i = hw_breakpoint_used_count ();
|
||||
target_resources_ok =
|
||||
target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
|
||||
diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/config/i386/nm-linux.h
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* Native support for GNU/Linux i386.
|
||||
+
|
||||
+ 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/>. */
|
||||
+
|
||||
+#ifndef NM_LINUX_H
|
||||
+#define NM_LINUX_H
|
||||
+
|
||||
+#include "config/nm-linux.h"
|
||||
+
|
||||
+/* Red Hat backward compatibility with gdb-6.8. */
|
||||
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
|
||||
+
|
||||
+#endif /* NM_LINUX64_H */
|
||||
diff --git a/gdb/config/i386/nm-linux64.h b/gdb/config/i386/nm-linux64.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/config/i386/nm-linux64.h
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* Native support for GNU/Linux amd64.
|
||||
+
|
||||
+ 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/>. */
|
||||
+
|
||||
+#ifndef NM_LINUX64_H
|
||||
+#define NM_LINUX64_H
|
||||
+
|
||||
+#include "config/nm-linux.h"
|
||||
+
|
||||
+/* Red Hat backward compatibility with gdb-6.8. */
|
||||
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
|
||||
+
|
||||
+#endif /* NM_LINUX64_H */
|
||||
diff --git a/gdb/configure.nat b/gdb/configure.nat
|
||||
--- a/gdb/configure.nat
|
||||
+++ b/gdb/configure.nat
|
||||
@@ -245,6 +245,7 @@ case ${gdb_host} in
|
||||
;;
|
||||
i386)
|
||||
# Host: Intel 386 running GNU/Linux.
|
||||
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux.h"
|
||||
NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \
|
||||
i386-linux-nat.o x86-linux-nat.o nat/linux-btrace.o \
|
||||
nat/x86-linux.o nat/x86-linux-dregs.o"
|
||||
@@ -301,6 +302,7 @@ case ${gdb_host} in
|
||||
case ${gdb_host_cpu} in
|
||||
i386)
|
||||
# Host: GNU/Linux x86-64
|
||||
+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux64.h"
|
||||
NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \
|
||||
amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \
|
||||
nat/linux-btrace.o \
|
||||
diff --git a/gdb/target.h b/gdb/target.h
|
||||
--- a/gdb/target.h
|
||||
+++ b/gdb/target.h
|
||||
@@ -1971,9 +1971,11 @@ extern struct thread_info *target_thread_handle_to_thread_info
|
||||
one. OTHERTYPE is the number of watchpoints of other types than
|
||||
this one used so far. */
|
||||
|
||||
+#ifndef target_can_use_hardware_watchpoint
|
||||
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
|
||||
(current_top_target ()->can_use_hw_breakpoint) ( \
|
||||
TYPE, CNT, OTHERTYPE)
|
||||
+#endif
|
||||
|
||||
/* Returns the number of debug registers needed to watch the given
|
||||
memory region, or zero if not supported. */
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
|
||||
@@ -0,0 +1,40 @@
|
||||
+# Copyright 2009, 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
|
||||
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
|
||||
+ && ![istarget "ia64-*-*"])
|
||||
+ || [target_info exists gdb,no_hardware_watchpoints]} then {
|
||||
+ verbose "Skipping watchpoint-hw-before-run test."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set test watchpoint-hw-before-run
|
||||
+set srcfile watchpoint-hw-hit-once.c
|
||||
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
|
||||
+
|
||||
+# `runto_main' or `runto main' would delete the watchpoint created above.
|
||||
+
|
||||
+if { [gdb_start_cmd] < 0 } {
|
||||
+ untested start
|
||||
+ return -1
|
||||
+}
|
||||
+gdb_test "" "main .* at .*" "start"
|
||||
+
|
||||
+gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
|
||||
|
||||
Hi,
|
||||
|
||||
unfortunately I see this problem reproducible only with the
|
||||
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
|
||||
OTOH this branch I hopefully submit in some form for FSF GDB later.
|
||||
|
||||
In this case (a general problem but tested for example on Fedora 13 i686):
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char a[argc];
|
||||
return a[0];
|
||||
}
|
||||
|
||||
(gdb) start
|
||||
(gdb) print a
|
||||
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
|
||||
|
||||
It is apparently because boundary for the variable `a' is not initialized
|
||||
there. Users notice it due to Eclipse-CDT trying to automatically display all
|
||||
the local variables on each step.
|
||||
|
||||
Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
||||
But is anone aware of the reasons to use internal_error there?
|
||||
I find simple error as a perfectly reasonable there.
|
||||
(history only tracks it since the initial import)
|
||||
|
||||
IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
|
||||
|
||||
I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
|
||||
sure if it can happen only due to the VLA variables.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
gdb/
|
||||
2010-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* utils.c (nomem): Change internal_error to error.
|
||||
|
||||
diff --git a/gdb/utils.c b/gdb/utils.c
|
||||
--- a/gdb/utils.c
|
||||
+++ b/gdb/utils.c
|
||||
@@ -721,13 +721,11 @@ malloc_failure (long size)
|
||||
{
|
||||
if (size > 0)
|
||||
{
|
||||
- internal_error (__FILE__, __LINE__,
|
||||
- _("virtual memory exhausted: can't allocate %ld bytes."),
|
||||
- size);
|
||||
+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
|
||||
}
|
||||
else
|
||||
{
|
||||
- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
|
||||
+ error (_("virtual memory exhausted."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -244,4 +244,3 @@ new file mode 100644
|
||||
+clean_restart $executable
|
||||
+
|
||||
+gdb_test "ptype main" {type = int \(void\)}
|
||||
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
Fix gdb.solib_address (fix by Phil Muldoon).
|
||||
|
||||
s/solib_address/solib_name/ during upstreaming.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -31,4 +27,3 @@ new file mode 100644
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists"
|
||||
|
||||
|
||||
@ -16,4 +16,3 @@ diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.e
|
||||
# Generate the intermediate object file. This is required by Darwin to
|
||||
# have access to the .debug_macinfo section.
|
||||
if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
--- a/gdb/remote.c
|
||||
+++ b/gdb/remote.c
|
||||
@@ -13966,7 +13966,17 @@ remote_target::pid_to_exec_file (int pid)
|
||||
@@ -13916,7 +13916,17 @@ remote_target::pid_to_exec_file (int pid)
|
||||
char *annex = NULL;
|
||||
|
||||
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
|
||||
@ -20,4 +20,3 @@ diff --git a/gdb/remote.c b/gdb/remote.c
|
||||
|
||||
inf = find_inferior_pid (pid);
|
||||
if (inf == NULL)
|
||||
|
||||
|
||||
@ -1,12 +1,3 @@
|
||||
http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
|
||||
Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
|
||||
[ New patch variant. ]
|
||||
|
||||
commit 7d760051ffb8a23cdc51342d4e6243fbc462f73f
|
||||
Author: Ulrich Weigand <uweigand@de.ibm.com>
|
||||
Date: Wed Sep 25 11:52:50 2013 +0000
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
|
||||
@ -18,7 +9,7 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
|
||||
|
||||
if [get_compiler_info] {
|
||||
return -1
|
||||
@@ -72,8 +73,26 @@ gdb_test "br foo2" \
|
||||
@@ -71,8 +72,26 @@ gdb_test "br foo2" \
|
||||
"Breakpoint.*: foo2. .2 locations..*" \
|
||||
"foo2 in mdlib"
|
||||
|
||||
@ -47,4 +38,3 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
|
||||
+gdb_run_cmd
|
||||
+gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \
|
||||
+ "warning for missing libraries"
|
||||
|
||||
|
||||
@ -1,75 +0,0 @@
|
||||
From 723adb650a31859d7cc45832cb8adca0206455ed Mon Sep 17 00:00:00 2001
|
||||
From: Sandra Loosemore <sandra@codesourcery.com>
|
||||
Date: Thu, 25 Apr 2019 07:27:02 -0700
|
||||
Subject: [PATCH] Detect invalid length field in debug frame FDE header.
|
||||
|
||||
GDB was failing to catch cases where a corrupt ELF or core file
|
||||
contained an invalid length value in a Dwarf debug frame FDE header.
|
||||
It was checking for buffer overflow but not cases where the length was
|
||||
negative or caused pointer wrap-around.
|
||||
|
||||
In addition to the additional validity check, this patch cleans up the
|
||||
multiple signed/unsigned conversions on the length field so that an
|
||||
unsigned representation is used consistently throughout.
|
||||
|
||||
This patch fixes CVE-2017-9778 and PR gdb/21600.
|
||||
|
||||
2019-04-25 Sandra Loosemore <sandra@codesourcery.com>
|
||||
Kang Li <kanglictf@gmail.com>
|
||||
|
||||
PR gdb/21600
|
||||
|
||||
* dwarf2-frame.c (read_initial_length): Be consistent about using
|
||||
unsigned representation of length.
|
||||
(decode_frame_entry_1): Likewise. Check for wraparound of
|
||||
end pointer as well as buffer overflow.
|
||||
---
|
||||
gdb/dwarf2-frame.c | 14 +++++++-------
|
||||
1 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
|
||||
index e2bf61b..b697afa 100644
|
||||
--- a/gdb/dwarf2-frame.c
|
||||
+++ b/gdb/dwarf2-frame.c
|
||||
@@ -1487,7 +1487,7 @@ static ULONGEST
|
||||
read_initial_length (bfd *abfd, const gdb_byte *buf,
|
||||
unsigned int *bytes_read_ptr)
|
||||
{
|
||||
- LONGEST result;
|
||||
+ ULONGEST result;
|
||||
|
||||
result = bfd_get_32 (abfd, buf);
|
||||
if (result == 0xffffffff)
|
||||
@@ -1788,7 +1788,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
|
||||
{
|
||||
struct gdbarch *gdbarch = get_objfile_arch (unit->objfile);
|
||||
const gdb_byte *buf, *end;
|
||||
- LONGEST length;
|
||||
+ ULONGEST length;
|
||||
unsigned int bytes_read;
|
||||
int dwarf64_p;
|
||||
ULONGEST cie_id;
|
||||
@@ -1799,15 +1799,15 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
|
||||
buf = start;
|
||||
length = read_initial_length (unit->abfd, buf, &bytes_read);
|
||||
buf += bytes_read;
|
||||
- end = buf + length;
|
||||
-
|
||||
- /* Are we still within the section? */
|
||||
- if (end > unit->dwarf_frame_buffer + unit->dwarf_frame_size)
|
||||
- return NULL;
|
||||
+ end = buf + (size_t) length;
|
||||
|
||||
if (length == 0)
|
||||
return end;
|
||||
|
||||
+ /* Are we still within the section? */
|
||||
+ if (end <= buf || end > unit->dwarf_frame_buffer + unit->dwarf_frame_size)
|
||||
+ return NULL;
|
||||
+
|
||||
/* Distinguish between 32 and 64-bit encoded frame info. */
|
||||
dwarf64_p = (bytes_read == 12);
|
||||
|
||||
--
|
||||
2.9.3
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1020004
|
||||
|
||||
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
|
||||
--- a/gdb/data-directory/Makefile.in
|
||||
+++ b/gdb/data-directory/Makefile.in
|
||||
@ -305,4 +303,3 @@ new file mode 100644
|
||||
+ pair[1].describe (sys.stdout, full)
|
||||
+
|
||||
+FilteringBacktrace()
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
Fedora: Force libncursesw over libncurses to match the includes.
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1270534
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -9418,6 +9418,7 @@ if test x"$prefer_curses" = xyes; then
|
||||
@@ -9375,6 +9375,7 @@ if test x"$prefer_curses" = xyes; then
|
||||
# search /usr/local/include, if ncurses is installed in /usr/local. A
|
||||
# default installation of ncurses on alpha*-dec-osf* will lead to such
|
||||
# a situation.
|
||||
@ -12,7 +9,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
|
||||
$as_echo_n "checking for library containing waddstr... " >&6; }
|
||||
if ${ac_cv_search_waddstr+:} false; then :
|
||||
@@ -9442,7 +9443,7 @@ return waddstr ();
|
||||
@@ -9399,7 +9400,7 @@ return waddstr ();
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
@ -21,7 +18,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
if test -z "$ac_lib"; then
|
||||
ac_res="none required"
|
||||
else
|
||||
@@ -9516,6 +9517,7 @@ case $host_os in
|
||||
@@ -9473,6 +9474,7 @@ case $host_os in
|
||||
esac
|
||||
|
||||
# These are the libraries checked by Readline.
|
||||
@ -29,7 +26,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
|
||||
$as_echo_n "checking for library containing tgetent... " >&6; }
|
||||
if ${ac_cv_search_tgetent+:} false; then :
|
||||
@@ -9540,7 +9542,7 @@ return tgetent ();
|
||||
@@ -9497,7 +9499,7 @@ return tgetent ();
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
@ -41,7 +38,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -743,7 +743,8 @@ if test x"$prefer_curses" = xyes; then
|
||||
@@ -717,7 +717,8 @@ if test x"$prefer_curses" = xyes; then
|
||||
# search /usr/local/include, if ncurses is installed in /usr/local. A
|
||||
# default installation of ncurses on alpha*-dec-osf* will lead to such
|
||||
# a situation.
|
||||
@ -51,7 +48,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
|
||||
if test "$ac_cv_search_waddstr" != no; then
|
||||
curses_found=yes
|
||||
@@ -785,7 +786,8 @@ case $host_os in
|
||||
@@ -759,7 +760,8 @@ case $host_os in
|
||||
esac
|
||||
|
||||
# These are the libraries checked by Readline.
|
||||
@ -61,4 +58,3 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
|
||||
if test "$ac_cv_search_tgetent" = no; then
|
||||
CONFIG_OBS="$CONFIG_OBS stub-termcap.o"
|
||||
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
Problem occurs with python and its get_current_arch () as it selects
|
||||
selected_frame and current_frame while still inferior_ptid is valid for the
|
||||
original parent. But since this place it is already attached and later
|
||||
unwinders try to access it, breaking:
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
|
||||
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
|
||||
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
|
||||
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -754,6 +754,9 @@ follow_fork (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
+ /* Possibly referenced PARENT is no longer valid. */
|
||||
+ reinit_frame_cache ();
|
||||
+
|
||||
/* This pending follow fork event is now handled, one way
|
||||
or another. The previous selected thread may be gone
|
||||
from the lists by now, but if it is still around, need
|
||||
|
||||
@ -1,25 +1,3 @@
|
||||
http://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
|
||||
|
||||
Hi,
|
||||
|
||||
for Fortran it fixes displaying normal strings also in frames/backtraces:
|
||||
|
||||
(gdb) frame
|
||||
->
|
||||
|
||||
The patch is simple and I do not see why it should not be this way.
|
||||
|
||||
For C/C++ TYPE_CODE_STRING is not used. I am not aware of Pascal but that
|
||||
language is currently not really much supported in GDB anyway.
|
||||
|
||||
This was a part of my archer/jankratochvil/vla branch but it is not a part of
|
||||
the Intel VLA patchset as it in fact is completely unrelated to "VLA".
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -94,4 +72,3 @@ new file mode 100644
|
||||
+ program main
|
||||
+ call f ('foo')
|
||||
+ end
|
||||
|
||||
|
||||
@ -118,4 +118,3 @@ new file mode 100644
|
||||
+
|
||||
+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
|
||||
+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
|
||||
|
||||
|
||||
@ -1,40 +1,7 @@
|
||||
http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html
|
||||
|
||||
--6TrnltStXW4iwmi0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline
|
||||
|
||||
Hi,
|
||||
|
||||
PR 16581:
|
||||
GDB crash on inherit_abstract_dies infinite recursion
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=16581
|
||||
|
||||
fixed crash from an infinite recursion. But in rare cases the new code can
|
||||
now gdb_assert() due to weird DWARF file.
|
||||
|
||||
I do not yet fully understand why the DWARF is as it is but just GDB should
|
||||
never crash due to invalid DWARF anyway. The "invalid" DWARF I see only in
|
||||
Fedora GCC build, not in FSF GCC build, more info at:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1069382
|
||||
http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
--6TrnltStXW4iwmi0
|
||||
Content-Type: text/plain; charset=us-ascii
|
||||
Content-Disposition: inline; filename="complaint.patch"
|
||||
|
||||
gdb/
|
||||
2014-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2read.c (process_die): Change gdb_assert to complaint.
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -10588,6 +10588,13 @@ private:
|
||||
@@ -10657,6 +10657,13 @@ private:
|
||||
static void
|
||||
process_die (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
@ -51,8 +18,8 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -609,6 +609,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
||||
target_pid_to_str (process_ptid));
|
||||
@@ -601,6 +601,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \
|
||||
target_pid_to_str (process_ptid).c_str ());
|
||||
}
|
||||
|
||||
+#ifdef NEED_DETACH_SIGSTOP
|
||||
@ -68,7 +35,7 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -192,6 +192,12 @@ struct linux_nat_target *linux_target;
|
||||
@@ -189,6 +189,12 @@ struct linux_nat_target *linux_target;
|
||||
/* Does the current host support PTRACE_GETREGSET? */
|
||||
enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
|
||||
|
||||
@ -81,7 +48,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
static unsigned int debug_linux_nat;
|
||||
static void
|
||||
show_debug_linux_nat (struct ui_file *file, int from_tty,
|
||||
@@ -1037,6 +1043,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
|
||||
@@ -1030,6 +1036,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
|
||||
if (debug_linux_nat)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"LNPAW: Attaching to a stopped process\n");
|
||||
@ -91,7 +58,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
|
||||
/* The process is definitely stopped. It is in a job control
|
||||
stop, unless the kernel predates the TASK_STOPPED /
|
||||
@@ -1369,6 +1378,25 @@ get_detach_signal (struct lwp_info *lp)
|
||||
@@ -1361,6 +1370,25 @@ get_detach_signal (struct lwp_info *lp)
|
||||
return gdb_signal_to_host (signo);
|
||||
}
|
||||
|
||||
@ -117,7 +84,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1517,6 +1545,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
|
||||
@@ -1509,6 +1537,10 @@ linux_nat_target::detach (inferior *inf, int from_tty)
|
||||
detach_one_lwp (main_lwp, &signo);
|
||||
|
||||
detach_success (inf);
|
||||
@ -128,7 +95,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1775,6 +1807,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
@@ -1766,6 +1798,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -143,9 +110,9 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
|
||||
+
|
||||
+#endif
|
||||
if (resume_many)
|
||||
iterate_over_lwps (ptid, linux_nat_resume_callback, lp);
|
||||
|
||||
@@ -3763,6 +3805,10 @@ linux_nat_target::mourn_inferior ()
|
||||
iterate_over_lwps (ptid, [=] (struct lwp_info *info)
|
||||
{
|
||||
@@ -3770,6 +3812,10 @@ linux_nat_target::mourn_inferior ()
|
||||
|
||||
/* Let the arch-specific native code know this process is gone. */
|
||||
linux_target->low_forget_process (pid);
|
||||
@ -226,4 +193,3 @@ diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.th
|
||||
|
||||
set test "$threadtype: attach2 to stopped, after setting file"
|
||||
gdb_test_multiple "attach $testpid" "$test" {
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -9705,10 +9705,12 @@ _ACEOF
|
||||
@@ -9694,10 +9694,12 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -820,10 +820,12 @@ AC_CHECK_SIZEOF(unsigned long long)
|
||||
@@ -808,10 +808,12 @@ AC_CHECK_SIZEOF(unsigned long long)
|
||||
AC_CHECK_SIZEOF(unsigned long)
|
||||
AC_CHECK_SIZEOF(unsigned __int128)
|
||||
|
||||
@ -36,4 +36,3 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
|
||||
TARGET_PTR="unsigned __int128"
|
||||
else
|
||||
|
||||
|
||||
@ -1,16 +1,24 @@
|
||||
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
|
||||
--- a/gdb/contrib/gdb-add-index.sh
|
||||
+++ b/gdb/contrib/gdb-add-index.sh
|
||||
@@ -21,6 +21,11 @@
|
||||
GDB=${GDB:=gdb}
|
||||
@@ -22,6 +22,20 @@ GDB=${GDB:=gdb}
|
||||
OBJCOPY=${OBJCOPY:=objcopy}
|
||||
READELF=${READELF:=readelf}
|
||||
|
||||
+GDB2=/usr/libexec/gdb
|
||||
+if test -x $GDB2 && ! which $GDB &>/dev/null; then
|
||||
+ GDB=$GDB2
|
||||
+fi
|
||||
+
|
||||
+# We default to using /usr/bin/gdb.minimal if it's present. See
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=1695015 and
|
||||
+# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot for
|
||||
+# explanations.
|
||||
+GDB3=/usr/bin/gdb.minimal
|
||||
+if test -x $GDB3; then
|
||||
+ GDB=$GDB3
|
||||
+fi
|
||||
+
|
||||
myname="${0##*/}"
|
||||
|
||||
dwarf5=""
|
||||
|
||||
|
||||
@ -1,11 +1,3 @@
|
||||
New testcase for:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=466222
|
||||
(for the first / customer recommended fix)
|
||||
and the upstream fix:
|
||||
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
|
||||
[rfc] Do not make up line information
|
||||
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -155,4 +147,3 @@ new file mode 100644
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -12137,7 +12137,7 @@ else
|
||||
@@ -11905,7 +11905,7 @@ else
|
||||
|
||||
#include <linux/perf_event.h>
|
||||
#ifndef PERF_ATTR_SIZE_VER5
|
||||
@ -13,7 +13,7 @@ diff --git a/gdb/configure b/gdb/configure
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -1500,7 +1500,7 @@ else
|
||||
@@ -1414,7 +1414,7 @@ else
|
||||
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <linux/perf_event.h>
|
||||
#ifndef PERF_ATTR_SIZE_VER5
|
||||
@ -48,7 +48,7 @@ diff --git a/gdb/gdb.c b/gdb/gdb.c
|
||||
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
|
||||
--- a/gdb/nat/linux-btrace.h
|
||||
+++ b/gdb/nat/linux-btrace.h
|
||||
@@ -28,6 +28,177 @@
|
||||
@@ -27,6 +27,177 @@
|
||||
# include <linux/perf_event.h>
|
||||
#endif
|
||||
|
||||
@ -226,4 +226,3 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
|
||||
struct target_ops;
|
||||
|
||||
#if HAVE_LINUX_PERF_EVENT_H
|
||||
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=590623
|
||||
http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593
|
||||
|
||||
Bug in FSF GDB exploited by the ptrace-on-utrace interaction.
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -11929,6 +11929,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
|
||||
@@ -11904,6 +11904,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
|
||||
traps we can no longer explain. */
|
||||
|
||||
old_loc->events_till_retirement = 3 * (thread_count () + 1);
|
||||
@ -15,4 +10,3 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
old_loc->owner = NULL;
|
||||
|
||||
moribund_locations.push_back (old_loc);
|
||||
|
||||
|
||||
@ -52,4 +52,3 @@ new file mode 100644
|
||||
+}
|
||||
+
|
||||
+gdb_test "disas _start" "Dump of assembler code for function _start:\r\n *0x\[0-9a-f\]+ <\[+\]0>:\tclflushopt \\(%edi\\)\r\nEnd of assembler dump\\." "clflushopt"
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -224,4 +222,3 @@ new file mode 100644
|
||||
+ void foo (char *);
|
||||
+};
|
||||
+
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -93,4 +91,3 @@ new file mode 100644
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
|
||||
|
||||
@ -293,4 +293,3 @@ new file mode 100644
|
||||
+ .long 0xedc07834 /* 194: frsqrtes f14,f15 */
|
||||
+ .long 0xedc07835 /* 198: frsqrtes. f14,f15 */
|
||||
+ .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */
|
||||
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
diff --git a/gdb/event-top.c b/gdb/event-top.c
|
||||
--- a/gdb/event-top.c
|
||||
+++ b/gdb/event-top.c
|
||||
@@ -1179,6 +1179,13 @@ gdb_setup_readline (int editing)
|
||||
{
|
||||
struct ui *ui = current_ui;
|
||||
|
||||
+#ifdef NEED_RL_STATE_FEDORA_GDB
|
||||
+ /* 6.2 regression: no longed asks for --more--
|
||||
+ gdb.base/readline-ask.exp
|
||||
+ https://bugzilla.redhat.com/show_bug.cgi?id=701131 */
|
||||
+ RL_SETSTATE (RL_STATE_FEDORA_GDB);
|
||||
+#endif
|
||||
+
|
||||
/* This function is a noop for the sync case. The assumption is
|
||||
that the sync setup is ALL done in gdb_init, and we would only
|
||||
mess it up here. The sync stuff should really go away over
|
||||
|
||||
@ -73,4 +73,3 @@ new file mode 100644
|
||||
+ ".*warning: Unable to find dynamic linker breakpoint function.*" \
|
||||
+ "set solib-absolute-prefix"
|
||||
+gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"
|
||||
|
||||
|
||||
@ -1,25 +1,3 @@
|
||||
Original message by Tom Tromey:
|
||||
|
||||
<https://sourceware.org/ml/gdb-patches/2012-03/msg00955.html>
|
||||
Message-ID: <871uoc1va3.fsf@fleche.redhat.com>
|
||||
|
||||
Comment from Sergio Durigan Junior:
|
||||
|
||||
In order to correctly test this patch, I wrote a testcase based on Jan
|
||||
Kratochvil's <gdb/testsuite/gdb.base/gcore-excessive-memory.exp>. The
|
||||
testcase, which can be seen below, tests GDB in order to see if the
|
||||
amount of memory being leaked is minimal, as requested in the bugzilla.
|
||||
It is hard to define what "minimum" is, so I ran the testcase on all
|
||||
supported RHEL architectures and came up with an average.
|
||||
|
||||
commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Wed Mar 28 17:38:08 2012 +0000
|
||||
|
||||
* python/py-inferior.c (infpy_read_memory): Remove cleanups and
|
||||
explicitly free 'buffer' on exit paths. Decref 'membuf_object'
|
||||
before returning.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -160,4 +138,3 @@ new file mode 100644
|
||||
+ print "Hello, World!"
|
||||
+
|
||||
+HelloWorld ()
|
||||
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
These testcases have been created by compiling glibc-2.17-78 on
|
||||
RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file
|
||||
present at $builddir/misc/select.o.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -224,4 +220,3 @@ new file mode 100644
|
||||
+L````(`````$````%````````````````````/`````$````%`````````$@`
|
||||
+`
|
||||
+end
|
||||
|
||||
|
||||
@ -1,38 +1,3 @@
|
||||
URL: <https://sourceware.org/ml/gdb-patches/2013-05/msg00364.html>
|
||||
Message-ID: <1368136582.30058.7.camel@soleil>
|
||||
|
||||
From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
|
||||
To: gdb-patches at sourceware dot org
|
||||
Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork
|
||||
Date: Thu, 09 May 2013 23:56:22 +0200
|
||||
|
||||
The attached patch fixes a gdb_assert caused by the combination of catch
|
||||
signal and fork:
|
||||
break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed.
|
||||
|
||||
The problem is that the signal_catch_counts is decremented by detach_breakpoints.
|
||||
The fix consists in not detaching breakpoint locations of type bp_loc_other.
|
||||
The patch introduces a new test.
|
||||
|
||||
Comments by Sergio Durigan Junior:
|
||||
|
||||
I addded a specific testcase for this patch, which tests exactly the
|
||||
issue that the customer is facing. This patch does not solve the
|
||||
whole problem of catching a syscall and forking (for more details,
|
||||
see <https://sourceware.org/bugzilla/show_bug.cgi?id=13457>,
|
||||
specifically comment #3), but it solves the issue reported by the
|
||||
customer.
|
||||
|
||||
I also removed the original testcase of this patch, because it
|
||||
relied on "catch signal", which is a command that is not implemented
|
||||
in this version of GDB.
|
||||
|
||||
commit bd9673a4ded96ea5c108601501c8e59003ea1be6
|
||||
Author: Philippe Waroquiers <philippe@sourceware.org>
|
||||
Date: Tue May 21 18:47:05 2013 +0000
|
||||
|
||||
Fix internal error caused by interaction between catch signal and fork
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -112,4 +77,3 @@ new file mode 100644
|
||||
+gdb_test "continue" \
|
||||
+ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \
|
||||
+ "continue from catch syscall after fork"
|
||||
|
||||
|
||||
@ -339,4 +339,3 @@ new file mode 100644
|
||||
+}
|
||||
+
|
||||
+test_stop_on_solib_events
|
||||
|
||||
|
||||
@ -1,14 +1,3 @@
|
||||
Comments from Sergio Durigan Junior:
|
||||
|
||||
The "proper" fix for this whole problem would be to backport the
|
||||
"ambiguous linespec" patch series. However, it is really not
|
||||
recommended to do that for RHEL GDB, because the patch series is too
|
||||
big and could introduce unwanted regressions. Instead, what we
|
||||
chose to do was to replace the gdb_assert call by a warning (which
|
||||
allows the user to continue the debugging session), and tell the
|
||||
user that, although more than one location was found for his/her
|
||||
breakpoint, only one will be used.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
@ -123,4 +112,3 @@ new file mode 100644
|
||||
+gdb_test "run"
|
||||
+
|
||||
+gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*"
|
||||
|
||||
|
||||
@ -94,4 +94,3 @@ new file mode 100644
|
||||
+setup_xfail "powerpc*-*-*"
|
||||
+
|
||||
+gdb_continue_to_end
|
||||
|
||||
|
||||
@ -166,4 +166,3 @@ new file mode 100644
|
||||
+ return frame_iter
|
||||
+
|
||||
+FrameFilter()
|
||||
|
||||
|
||||
@ -1,9 +1,3 @@
|
||||
Typo in Python support breaks info type-printers command
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1350436
|
||||
|
||||
[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers
|
||||
https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc
|
||||
--- a/gdb/testsuite/gdb.python/py-typeprint.cc
|
||||
+++ b/gdb/testsuite/gdb.python/py-typeprint.cc
|
||||
@ -71,4 +65,3 @@ diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python
|
||||
+
|
||||
+import gdb.types
|
||||
+gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter())
|
||||
|
||||
|
||||
@ -1,454 +0,0 @@
|
||||
Implement dump of mappings with ELF headers by gcore
|
||||
|
||||
This patch has a long story, but it all started back in 2015, with
|
||||
commit df8411da087dc05481926f4c4a82deabc5bc3859 ("Implement support
|
||||
for checking /proc/PID/coredump_filter"). The purpose of that commit
|
||||
was to bring GDB's corefile generation closer to what the Linux kernel
|
||||
does. However, back then, I did not implement the full support for
|
||||
the dumping of memory mappings containing ELF headers (like mappings
|
||||
of DSOs or executables). These mappings were being dumped most of
|
||||
time, though, because the default value of /proc/PID/coredump_filter
|
||||
is 0x33, which would cause anonymous private mappings (DSOs/executable
|
||||
code mappings have this type) to be dumped. Well, until something
|
||||
happened on binutils...
|
||||
|
||||
A while ago, I noticed something strange was happening with one of our
|
||||
local testcases on Fedora GDB: it was failing due to some strange
|
||||
build-id problem. On Fedora GDB, we (unfortunately) carry a bunch of
|
||||
"local" patches, and some of these patches actually extend upstream's
|
||||
build-id support in order to generate more useful information for the
|
||||
user of a Fedora system (for example, when the user loads a corefile
|
||||
into GDB, we detect whether the executable that generated that
|
||||
corefile is present, and if it's not we issue a warning suggesting
|
||||
that it should be installed, while also providing the build-id of the
|
||||
executable). A while ago, Fedora GDB stopped printing those warnings.
|
||||
|
||||
I wanted to investigate this right away, and spent some time trying to
|
||||
determine what was going on, but other things happened and I got
|
||||
sidetracked. Meanwhile, the bug started to be noticed by some of our
|
||||
users, and its priority started changing. Then, someone on IRC also
|
||||
mentioned the problem, and when I tried helping him, I noticed he
|
||||
wasn't running Fedora. Hm... So maybe the bug was *also* present
|
||||
upstream.
|
||||
|
||||
After "some" time investigating, and with a lot of help from Keith and
|
||||
others, I was finally able to determine that yes, the bug is also
|
||||
present upstream, and that even though it started with a change in ld,
|
||||
it is indeed a GDB issue.
|
||||
|
||||
So, as I said, the problem started with binutils, more specifically
|
||||
after the following commit was pushed:
|
||||
|
||||
commit f6aec96dce1ddbd8961a3aa8a2925db2021719bb
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Tue Feb 27 11:34:20 2018 -0800
|
||||
|
||||
ld: Add --enable-separate-code
|
||||
|
||||
This commit makes ld use "-z separate-code" by default on x86-64
|
||||
machines. What this means is that code pages and data pages are now
|
||||
separated in the binary, which is confusing GDB when it tries to decide
|
||||
what to dump.
|
||||
|
||||
BTW, Fedora 28 binutils doesn't have this code, which means that
|
||||
Fedora 28 GDB doesn't have the problem. From Fedora 29 on, binutils
|
||||
was rebased and incorporated the commit above, which started causing
|
||||
Fedora GDB to fail.
|
||||
|
||||
Anyway, the first thing I tried was to pass "-z max-page-size" and
|
||||
specify a bigger page size (I saw a patch that did this and was
|
||||
proposed to Linux, so I thought it might help). Obviously, this
|
||||
didn't work, because the real "problem" is that ld will always use
|
||||
separate pages for code and data. So I decided to look into how GDB
|
||||
dumped the pages, and that's where I found the real issue.
|
||||
|
||||
What happens is that, because of "-z separate-code", the first two pages
|
||||
of the ELF binary are (from /proc/PID/smaps):
|
||||
|
||||
00400000-00401000 r--p 00000000 fc:01 799548 /file
|
||||
Size: 4 kB
|
||||
KernelPageSize: 4 kB
|
||||
MMUPageSize: 4 kB
|
||||
Rss: 4 kB
|
||||
Pss: 4 kB
|
||||
Shared_Clean: 0 kB
|
||||
Shared_Dirty: 0 kB
|
||||
Private_Clean: 4 kB
|
||||
Private_Dirty: 0 kB
|
||||
Referenced: 4 kB
|
||||
Anonymous: 0 kB
|
||||
LazyFree: 0 kB
|
||||
AnonHugePages: 0 kB
|
||||
ShmemPmdMapped: 0 kB
|
||||
Shared_Hugetlb: 0 kB
|
||||
Private_Hugetlb: 0 kB
|
||||
Swap: 0 kB
|
||||
SwapPss: 0 kB
|
||||
Locked: 0 kB
|
||||
THPeligible: 0
|
||||
VmFlags: rd mr mw me dw sd
|
||||
00401000-00402000 r-xp 00001000 fc:01 799548 /file
|
||||
Size: 4 kB
|
||||
KernelPageSize: 4 kB
|
||||
MMUPageSize: 4 kB
|
||||
Rss: 4 kB
|
||||
Pss: 4 kB
|
||||
Shared_Clean: 0 kB
|
||||
Shared_Dirty: 0 kB
|
||||
Private_Clean: 0 kB
|
||||
Private_Dirty: 4 kB
|
||||
Referenced: 4 kB
|
||||
Anonymous: 4 kB
|
||||
LazyFree: 0 kB
|
||||
AnonHugePages: 0 kB
|
||||
ShmemPmdMapped: 0 kB
|
||||
Shared_Hugetlb: 0 kB
|
||||
Private_Hugetlb: 0 kB
|
||||
Swap: 0 kB
|
||||
SwapPss: 0 kB
|
||||
Locked: 0 kB
|
||||
THPeligible: 0
|
||||
VmFlags: rd ex mr mw me dw sd
|
||||
|
||||
Whereas before, we had only one:
|
||||
|
||||
00400000-00401000 r-xp 00000000 fc:01 798593 /file
|
||||
Size: 4 kB
|
||||
KernelPageSize: 4 kB
|
||||
MMUPageSize: 4 kB
|
||||
Rss: 4 kB
|
||||
Pss: 4 kB
|
||||
Shared_Clean: 0 kB
|
||||
Shared_Dirty: 0 kB
|
||||
Private_Clean: 0 kB
|
||||
Private_Dirty: 4 kB
|
||||
Referenced: 4 kB
|
||||
Anonymous: 4 kB
|
||||
LazyFree: 0 kB
|
||||
AnonHugePages: 0 kB
|
||||
ShmemPmdMapped: 0 kB
|
||||
Shared_Hugetlb: 0 kB
|
||||
Private_Hugetlb: 0 kB
|
||||
Swap: 0 kB
|
||||
SwapPss: 0 kB
|
||||
Locked: 0 kB
|
||||
THPeligible: 0
|
||||
VmFlags: rd ex mr mw me dw sd
|
||||
|
||||
Notice how we have "Anonymous" data mapped into the page. This will be
|
||||
important.
|
||||
|
||||
So, the way GDB decides which pages it should dump has been revamped
|
||||
by my patch in 2015, and now it takes the contents of
|
||||
/proc/PID/coredump_filter into account. The default value for Linux
|
||||
is 0x33, which means:
|
||||
|
||||
Dump anonymous private, anonymous shared, ELF headers and HugeTLB
|
||||
private pages.
|
||||
|
||||
Or:
|
||||
|
||||
filter_flags filterflags = (COREFILTER_ANON_PRIVATE
|
||||
| COREFILTER_ANON_SHARED
|
||||
| COREFILTER_ELF_HEADERS
|
||||
| COREFILTER_HUGETLB_PRIVATE);
|
||||
|
||||
Now, it is important to keep in mind that GDB doesn't always have *all*
|
||||
of the necessary information to exactly determine the type of a page, so
|
||||
the whole algorithm is based on heuristics (you can take a look at
|
||||
linux-tdep.c:dump_mapping_p and
|
||||
linux-tdep.c:linux_find_memory_regions_full for more info).
|
||||
|
||||
Before the patch to make ld use "-z separate-code", the (single) page
|
||||
containing data and code was being flagged as an anonymous (due to the
|
||||
non-zero "Anonymous:" field) private (due to the "r-xp" permission),
|
||||
which means that it was being dumped into the corefile. That's why it
|
||||
was working fine.
|
||||
|
||||
Now, as you can imagine, when "-z separate-code" is used, the *data*
|
||||
page (which is where the ELF notes are, including the build-id one) now
|
||||
doesn't have any "Anonymous:" mapping, so the heuristic is flagging it
|
||||
as file-backed private, which is *not* dumped by default.
|
||||
|
||||
The next question I had to answer was: how come a corefile generated by
|
||||
the Linux kernel was correct? Well, the answer is that GDB, unlike
|
||||
Linux, doesn't actually implement the COREFILTER_ELF_HEADERS support.
|
||||
On Linux, even though the data page is also treated as a file-backed
|
||||
private mapping, it is also checked to see if there are any ELF headers
|
||||
in the page, and then, because we *do* have ELF headers there, it is
|
||||
dumped.
|
||||
|
||||
So, after more time trying to think of ways to fix this, I was able to
|
||||
implement an algorithm that reads the first few bytes of the memory
|
||||
mapping being processed, and checks to see if the ELF magic code is
|
||||
present. This is basically what Linux does as well, except that, if
|
||||
it finds the ELF magic code, it just dumps one page to the corefile,
|
||||
whereas GDB will dump the whole mapping. But I don't think that's a
|
||||
big issue, to be honest.
|
||||
|
||||
It's also important to explain that we *only* perform the ELF magic
|
||||
code check if:
|
||||
|
||||
- The algorithm has decided *not* to dump the mapping so far, and;
|
||||
- The mapping is private, and;
|
||||
- The mapping's offset is zero, and;
|
||||
- The user has requested us to dump mappings with ELF headers.
|
||||
|
||||
IOW, we're not going to blindly check every mapping.
|
||||
|
||||
As for the testcase, I struggled even more trying to write it. Since
|
||||
our build-id support on upstream GDB is not very extensive, it's not
|
||||
really possible to determine whether a corefile contains build-id
|
||||
information or not just by using GDB. So, after thinking a lot about
|
||||
the problem, I decided to rely on an external tool, eu-unstrip, in
|
||||
order to verify whether the dump was successful. I verified the test
|
||||
here on my machine, and everything seems to work as expected (i.e., it
|
||||
fails without the patch, and works with the patch applied). We are
|
||||
working hard to upstream our "local" Fedora GDB patches, and we intend
|
||||
to submit our build-id extension patches "soon", so hopefully we'll be
|
||||
able to use GDB itself to perform this verification.
|
||||
|
||||
I built and regtested this on the BuildBot, and no problems were
|
||||
found.
|
||||
|
||||
gdb/ChangeLog:
|
||||
2019-04-25 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
PR corefiles/11608
|
||||
PR corefiles/18187
|
||||
* linux-tdep.c (dump_mapping_p): Add new parameters ADDR and
|
||||
OFFSET. Verify if current mapping contains an ELF header.
|
||||
(linux_find_memory_regions_full): Adjust call to
|
||||
dump_mapping_p.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
2019-04-25 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
PR corefiles/11608
|
||||
PR corefiles/18187
|
||||
* gdb.base/coredump-filter-build-id.exp: New file.
|
||||
|
||||
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
|
||||
--- a/gdb/linux-tdep.c
|
||||
+++ b/gdb/linux-tdep.c
|
||||
@@ -591,8 +591,8 @@ mapping_is_anonymous_p (const char *filename)
|
||||
}
|
||||
|
||||
/* Return 0 if the memory mapping (which is related to FILTERFLAGS, V,
|
||||
- MAYBE_PRIVATE_P, and MAPPING_ANONYMOUS_P) should not be dumped, or
|
||||
- greater than 0 if it should.
|
||||
+ MAYBE_PRIVATE_P, MAPPING_ANONYMOUS_P, ADDR and OFFSET) should not
|
||||
+ be dumped, or greater than 0 if it should.
|
||||
|
||||
In a nutshell, this is the logic that we follow in order to decide
|
||||
if a mapping should be dumped or not.
|
||||
@@ -630,12 +630,17 @@ mapping_is_anonymous_p (const char *filename)
|
||||
see 'p' in the permission flags, then we assume that the mapping
|
||||
is private, even though the presence of the 's' flag there would
|
||||
mean VM_MAYSHARE, which means the mapping could still be private.
|
||||
- This should work OK enough, however. */
|
||||
+ This should work OK enough, however.
|
||||
+
|
||||
+ - Even if, at the end, we decided that we should not dump the
|
||||
+ mapping, we still have to check if it is something like an ELF
|
||||
+ header (of a DSO or an executable, for example). If it is, and
|
||||
+ if the user is interested in dump it, then we should dump it. */
|
||||
|
||||
static int
|
||||
dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
|
||||
int maybe_private_p, int mapping_anon_p, int mapping_file_p,
|
||||
- const char *filename)
|
||||
+ const char *filename, ULONGEST addr, ULONGEST offset)
|
||||
{
|
||||
/* Initially, we trust in what we received from our caller. This
|
||||
value may not be very precise (i.e., it was probably gathered
|
||||
@@ -645,6 +650,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
|
||||
(assuming that the version of the Linux kernel being used
|
||||
supports it, of course). */
|
||||
int private_p = maybe_private_p;
|
||||
+ int dump_p;
|
||||
|
||||
/* We always dump vDSO and vsyscall mappings, because it's likely that
|
||||
there'll be no file to read the contents from at core load time.
|
||||
@@ -685,13 +691,13 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
|
||||
/* This is a special situation. It can happen when we see a
|
||||
mapping that is file-backed, but that contains anonymous
|
||||
pages. */
|
||||
- return ((filterflags & COREFILTER_ANON_PRIVATE) != 0
|
||||
- || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0);
|
||||
+ dump_p = ((filterflags & COREFILTER_ANON_PRIVATE) != 0
|
||||
+ || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0);
|
||||
}
|
||||
else if (mapping_anon_p)
|
||||
- return (filterflags & COREFILTER_ANON_PRIVATE) != 0;
|
||||
+ dump_p = (filterflags & COREFILTER_ANON_PRIVATE) != 0;
|
||||
else
|
||||
- return (filterflags & COREFILTER_MAPPED_PRIVATE) != 0;
|
||||
+ dump_p = (filterflags & COREFILTER_MAPPED_PRIVATE) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -700,14 +706,55 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
|
||||
/* This is a special situation. It can happen when we see a
|
||||
mapping that is file-backed, but that contains anonymous
|
||||
pages. */
|
||||
- return ((filterflags & COREFILTER_ANON_SHARED) != 0
|
||||
- || (filterflags & COREFILTER_MAPPED_SHARED) != 0);
|
||||
+ dump_p = ((filterflags & COREFILTER_ANON_SHARED) != 0
|
||||
+ || (filterflags & COREFILTER_MAPPED_SHARED) != 0);
|
||||
}
|
||||
else if (mapping_anon_p)
|
||||
- return (filterflags & COREFILTER_ANON_SHARED) != 0;
|
||||
+ dump_p = (filterflags & COREFILTER_ANON_SHARED) != 0;
|
||||
else
|
||||
- return (filterflags & COREFILTER_MAPPED_SHARED) != 0;
|
||||
+ dump_p = (filterflags & COREFILTER_MAPPED_SHARED) != 0;
|
||||
}
|
||||
+
|
||||
+ /* Even if we decided that we shouldn't dump this mapping, we still
|
||||
+ have to check whether (a) the user wants us to dump mappings
|
||||
+ containing an ELF header, and (b) the mapping in question
|
||||
+ contains an ELF header. If (a) and (b) are true, then we should
|
||||
+ dump this mapping.
|
||||
+
|
||||
+ A mapping contains an ELF header if it is a private mapping, its
|
||||
+ offset is zero, and its first word is ELFMAG. */
|
||||
+ if (!dump_p && private_p && offset == 0
|
||||
+ && (filterflags & COREFILTER_ELF_HEADERS) != 0)
|
||||
+ {
|
||||
+ /* Let's check if we have an ELF header. */
|
||||
+ gdb::unique_xmalloc_ptr<char> header;
|
||||
+ int errcode;
|
||||
+
|
||||
+ /* Useful define specifying the size of the ELF magical
|
||||
+ header. */
|
||||
+#ifndef SELFMAG
|
||||
+#define SELFMAG 4
|
||||
+#endif
|
||||
+
|
||||
+ /* Read the first SELFMAG bytes and check if it is ELFMAG. */
|
||||
+ if (target_read_string (addr, &header, SELFMAG, &errcode) == SELFMAG
|
||||
+ && errcode == 0)
|
||||
+ {
|
||||
+ const char *h = header.get ();
|
||||
+
|
||||
+ /* The EI_MAG* and ELFMAG* constants come from
|
||||
+ <elf/common.h>. */
|
||||
+ if (h[EI_MAG0] == ELFMAG0 && h[EI_MAG1] == ELFMAG1
|
||||
+ && h[EI_MAG2] == ELFMAG2 && h[EI_MAG3] == ELFMAG3)
|
||||
+ {
|
||||
+ /* This mapping contains an ELF header, so we
|
||||
+ should dump it. */
|
||||
+ dump_p = 1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return dump_p;
|
||||
}
|
||||
|
||||
/* Implement the "info proc" command. */
|
||||
@@ -1311,7 +1358,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
|
||||
if (has_anonymous)
|
||||
should_dump_p = dump_mapping_p (filterflags, &v, priv,
|
||||
mapping_anon_p, mapping_file_p,
|
||||
- filename);
|
||||
+ filename, addr, offset);
|
||||
else
|
||||
{
|
||||
/* Older Linux kernels did not support the "Anonymous:" counter.
|
||||
diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp
|
||||
@@ -0,0 +1,69 @@
|
||||
+# Copyright 2019 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/>.
|
||||
+
|
||||
+# Test whether GDB's gcore/generate-core-file command can dump memory
|
||||
+# mappings with ELF headers, containing a build-id note.
|
||||
+#
|
||||
+# Due to the fact that we don't have an easy way to process a corefile
|
||||
+# and look for specific notes using GDB/dejagnu, we rely on an
|
||||
+# external tool, eu-unstrip, to verify if the corefile contains
|
||||
+# build-ids.
|
||||
+
|
||||
+standard_testfile "normal.c"
|
||||
+
|
||||
+# This test is Linux x86_64 only.
|
||||
+if { ![istarget *-*-linux*] } {
|
||||
+ untested "$testfile.exp"
|
||||
+ return -1
|
||||
+}
|
||||
+if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } {
|
||||
+ untested "$testfile.exp"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ untested "could not run to main"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# First we need to generate a corefile.
|
||||
+set corefilename "[standard_output_file gcore.test]"
|
||||
+if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } {
|
||||
+ verbose -log "Could not save corefile"
|
||||
+ untested "$testfile.exp"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Determine if GDB dumped the mapping containing the build-id. This
|
||||
+# is done by invoking an external program (eu-unstrip).
|
||||
+if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefilename" output] == 0 } {
|
||||
+ set line [lindex [split $output "\n"] 0]
|
||||
+ set test "gcore dumped mapping with build-id"
|
||||
+
|
||||
+ verbose -log "First line of eu-unstrip: $line"
|
||||
+
|
||||
+ if { [regexp "^${hex}\\+${hex} \[a-f0-9\]+@${hex}.*[string_to_regexp $binfile]$" $line] } {
|
||||
+ pass "$test"
|
||||
+ } else {
|
||||
+ fail "$test"
|
||||
+ }
|
||||
+} else {
|
||||
+ verbose -log "Could not execute eu-unstrip program"
|
||||
+ untested "$testfile.exp"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
|
||||
--- a/gdb/testsuite/lib/future.exp
|
||||
+++ b/gdb/testsuite/lib/future.exp
|
||||
@@ -162,6 +162,16 @@ proc gdb_find_readelf {} {
|
||||
return $readelf
|
||||
}
|
||||
|
||||
+proc gdb_find_eu-unstrip {} {
|
||||
+ global EU_UNSTRIP_FOR_TARGET
|
||||
+ if [info exists EU_UNSTRIP_FOR_TARGET] {
|
||||
+ set eu_unstrip $EU_UNSTRIP_FOR_TARGET
|
||||
+ } else {
|
||||
+ set eu_unstrip [transform eu-unstrip]
|
||||
+ }
|
||||
+ return $eu_unstrip
|
||||
+}
|
||||
+
|
||||
proc gdb_default_target_compile {source destfile type options} {
|
||||
global target_triplet
|
||||
global tool_root_dir
|
||||
|
||||
@ -444,4 +444,3 @@ new file mode 100644
|
||||
+clean_restart ${debugfile}
|
||||
+
|
||||
+gdb_test "complete p si" "complete p si\r\np size_of_encoded_value"
|
||||
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
Stop the BFD library from issuing a warning message when processing allocated sections in debuginfo files that lie outside of any loadable segment.
|
||||
|
||||
PR 24717
|
||||
* elf.c (is_debuginfo_file): New function.
|
||||
(assign_file_positions_for_non_load_sections): Do not warn about
|
||||
allocated sections outside of loadable segments if they are found
|
||||
in a debuginfo file.
|
||||
* elf-bfd.h (is_debuginfo_file): Prototype.
|
||||
|
||||
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
|
||||
--- a/bfd/elf-bfd.h
|
||||
+++ b/bfd/elf-bfd.h
|
||||
@@ -2751,6 +2751,8 @@ extern bfd_vma elf64_r_sym (bfd_vma);
|
||||
extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
|
||||
extern bfd_vma elf32_r_sym (bfd_vma);
|
||||
|
||||
+extern bfd_boolean is_debuginfo_file (bfd *);
|
||||
+
|
||||
/* Large common section. */
|
||||
extern asection _bfd_elf_large_com_section;
|
||||
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -5800,6 +5800,35 @@ assign_file_positions_for_load_sections (bfd *abfd,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+/* Determine if a bfd is a debuginfo file. Unfortunately there
|
||||
+ is no defined method for detecting such files, so we have to
|
||||
+ use heuristics instead. */
|
||||
+
|
||||
+bfd_boolean
|
||||
+is_debuginfo_file (bfd *abfd)
|
||||
+{
|
||||
+ if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ Elf_Internal_Shdr **start_headers = elf_elfsections (abfd);
|
||||
+ Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd);
|
||||
+ Elf_Internal_Shdr **headerp;
|
||||
+
|
||||
+ for (headerp = start_headers; headerp < end_headers; headerp ++)
|
||||
+ {
|
||||
+ Elf_Internal_Shdr *header = * headerp;
|
||||
+
|
||||
+ /* Debuginfo files do not have any allocated SHT_PROGBITS sections.
|
||||
+ The only allocated sections are SHT_NOBITS or SHT_NOTES. */
|
||||
+ if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC
|
||||
+ && header->sh_type != SHT_NOBITS
|
||||
+ && header->sh_type != SHT_NOTE)
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
/* Assign file positions for the other sections. */
|
||||
|
||||
static bfd_boolean
|
||||
@@ -5833,7 +5862,13 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
|
||||
BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos);
|
||||
else if ((hdr->sh_flags & SHF_ALLOC) != 0)
|
||||
{
|
||||
- if (hdr->sh_size != 0)
|
||||
+ if (hdr->sh_size != 0
|
||||
+ /* PR 24717 - debuginfo files are known to be not strictly
|
||||
+ compliant with the ELF standard. In particular they often
|
||||
+ have .note.gnu.property sections that are outside of any
|
||||
+ loadable segment. This is not a problem for such files,
|
||||
+ so do not warn about them. */
|
||||
+ && ! is_debuginfo_file (abfd))
|
||||
_bfd_error_handler
|
||||
/* xgettext:c-format */
|
||||
(_("%pB: warning: allocated section `%s' not in segment"),
|
||||
|
||||
@ -71,4 +71,3 @@ new file mode 100644
|
||||
+H`````````2@`````````#@````````````````````$`````````````
|
||||
+`
|
||||
+end
|
||||
|
||||
|
||||
@ -1,81 +0,0 @@
|
||||
Add "style" proc to the test suite
|
||||
|
||||
This adds a "style" helper proc to the test suite, and updates
|
||||
existing style tests to use it. Thanks to Sergio for the idea.
|
||||
|
||||
Tested on x86-64 Fedora 29.
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2019-05-22 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
* gdb.base/info-shared.exp (check_info_shared): Use "style".
|
||||
* gdb.base/style.exp: Use "style".
|
||||
* lib/gdb-utils.exp (style): New proc.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
|
||||
--- a/gdb/testsuite/gdb.base/style.exp
|
||||
+++ b/gdb/testsuite/gdb.base/style.exp
|
||||
@@ -41,10 +41,10 @@ save_vars { env(TERM) } {
|
||||
|
||||
gdb_test_no_output "set style enabled on"
|
||||
|
||||
- set main_expr "\033\\\[33mmain\033\\\[m"
|
||||
- set base_file_expr "\033\\\[32m.*style\\.c\033\\\[m"
|
||||
+ set main_expr [style main function]
|
||||
+ set base_file_expr [style ".*style\\.c" file]
|
||||
set file_expr "$base_file_expr:\[0-9\]"
|
||||
- set arg_expr "\033\\\[36marg.\033\\\[m"
|
||||
+ set arg_expr [style "arg." variable]
|
||||
|
||||
gdb_test "frame" \
|
||||
"$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*"
|
||||
@@ -58,7 +58,7 @@ save_vars { env(TERM) } {
|
||||
|
||||
gdb_test "break main" "file $base_file_expr.*"
|
||||
|
||||
- gdb_test "print &main" " = .* \033\\\[34m$hex\033\\\[m <$main_expr>"
|
||||
+ gdb_test "print &main" " = .* [style $hex address] <$main_expr>"
|
||||
|
||||
# Regression test for a bug where line-wrapping would occur at the
|
||||
# wrong spot with styling. There were different bugs at different
|
||||
@@ -86,11 +86,12 @@ save_vars { env(TERM) } {
|
||||
gdb_exit
|
||||
gdb_spawn
|
||||
|
||||
- gdb_test "" "\033\\\[35;1mGNU gdb.*\033\\\[m.*" \
|
||||
+ set vers [style "GNU gdb.*" "35;1"]
|
||||
+ gdb_test "" "${vers}.*" \
|
||||
"version is styled"
|
||||
|
||||
set quoted [string_to_regexp $binfile]
|
||||
gdb_test "file $binfile" \
|
||||
- "Reading symbols from \033\\\[32m${quoted}\033\\\[m..." \
|
||||
+ "Reading symbols from [style $quoted file]..." \
|
||||
"filename is styled when loading symbol file"
|
||||
}
|
||||
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
|
||||
--- a/gdb/testsuite/lib/gdb-utils.exp
|
||||
+++ b/gdb/testsuite/lib/gdb-utils.exp
|
||||
@@ -37,3 +37,21 @@ proc string_to_regexp {str} {
|
||||
regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result
|
||||
return $result
|
||||
}
|
||||
+
|
||||
+# Wrap STR in an ANSI terminal escape sequences -- one to set the
|
||||
+# style to STYLE, and one to reset the style to the default. The
|
||||
+# return value is suitable for use as a regular expression.
|
||||
+
|
||||
+# STYLE can either be the payload part of an ANSI terminal sequence,
|
||||
+# or a shorthand for one of the gdb standard styles: "file",
|
||||
+# "function", "variable", or "address".
|
||||
+
|
||||
+proc style {str style} {
|
||||
+ switch -exact -- $style {
|
||||
+ file { set style 32 }
|
||||
+ function { set style 33 }
|
||||
+ variable { set style 36 }
|
||||
+ address { set style 34 }
|
||||
+ }
|
||||
+ return "\033\\\[${style}m${str}\033\\\[m"
|
||||
+}
|
||||
|
||||
@ -1,187 +0,0 @@
|
||||
Do not emit style escape sequences to log file
|
||||
|
||||
PR gdb/24502 requests that the "set logging" log file not contain
|
||||
style escape sequences emitted by gdb.
|
||||
|
||||
This seemed like a reasonable request to me, so this patch implements
|
||||
filtering for the log file.
|
||||
|
||||
This also updates a comment in ui-style.h that I noticed while writing
|
||||
the patch.
|
||||
|
||||
Tested on x86-64 Fedora 29.
|
||||
|
||||
gdb/ChangeLog
|
||||
2019-06-14 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
PR gdb/24502:
|
||||
* ui-style.h (skip_ansi_escape): Update comment.
|
||||
* ui-file.h (class no_terminal_escape_file): New class.
|
||||
* ui-file.c (no_terminal_escape_file::write)
|
||||
(no_terminal_escape_file::puts): New methods.
|
||||
* cli/cli-logging.c (handle_redirections): Use
|
||||
no_terminal_escape_file.
|
||||
|
||||
gdb/testsuite/ChangeLog
|
||||
2019-06-14 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
PR gdb/24502:
|
||||
* gdb.base/style-logging.exp: New file.
|
||||
|
||||
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
|
||||
--- a/gdb/cli/cli-logging.c
|
||||
+++ b/gdb/cli/cli-logging.c
|
||||
@@ -117,7 +117,7 @@ handle_redirections (int from_tty)
|
||||
return;
|
||||
}
|
||||
|
||||
- stdio_file_up log (new stdio_file ());
|
||||
+ stdio_file_up log (new no_terminal_escape_file ());
|
||||
if (!log->open (logging_filename, logging_overwrite ? "w" : "a"))
|
||||
perror_with_name (_("set logging"));
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/style-logging.exp
|
||||
@@ -0,0 +1,64 @@
|
||||
+# Copyright 2019 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/>.
|
||||
+
|
||||
+# Test that logging does not style.
|
||||
+
|
||||
+if {[is_remote host]} {
|
||||
+ untested "does not work on remote host"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+standard_testfile style.c
|
||||
+
|
||||
+save_vars { env(TERM) } {
|
||||
+ # We need an ANSI-capable terminal to get the output.
|
||||
+ setenv TERM ansi
|
||||
+
|
||||
+ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
|
||||
+ return -1
|
||||
+ }
|
||||
+
|
||||
+ if {![runto_main]} {
|
||||
+ fail "style tests failed"
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
+ gdb_test_no_output "set style enabled on"
|
||||
+
|
||||
+ set log_name [standard_output_file log.txt]
|
||||
+ gdb_test_no_output "set logging file $log_name"
|
||||
+ gdb_test_no_output "set logging overwrite on"
|
||||
+ gdb_test "set logging on" "Copying output to .*"
|
||||
+
|
||||
+ set main_expr [style main function]
|
||||
+ set base_file_expr [style ".*style\\.c" file]
|
||||
+ set file_expr "$base_file_expr:\[0-9\]"
|
||||
+ set arg_expr [style "arg." variable]
|
||||
+ gdb_test "frame" \
|
||||
+ "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*"
|
||||
+
|
||||
+ gdb_test "set logging off" "Done logging to .*"
|
||||
+
|
||||
+ set fd [open $log_name]
|
||||
+ set data [read -nonewline $fd]
|
||||
+ close $fd
|
||||
+
|
||||
+ set testname "log is escape-free"
|
||||
+ if {[regexp "\033" $data]} {
|
||||
+ fail $testname
|
||||
+ } else {
|
||||
+ pass $testname
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
|
||||
--- a/gdb/ui-file.c
|
||||
+++ b/gdb/ui-file.c
|
||||
@@ -332,3 +332,33 @@ tee_file::isatty ()
|
||||
{
|
||||
return m_one->isatty ();
|
||||
}
|
||||
+
|
||||
+void
|
||||
+no_terminal_escape_file::write (const char *buf, long length_buf)
|
||||
+{
|
||||
+ std::string copy (buf, length_buf);
|
||||
+ this->puts (copy.c_str ());
|
||||
+}
|
||||
+
|
||||
+/* See ui-file.h. */
|
||||
+
|
||||
+void
|
||||
+no_terminal_escape_file::puts (const char *buf)
|
||||
+{
|
||||
+ while (*buf != '\0')
|
||||
+ {
|
||||
+ const char *esc = strchr (buf, '\033');
|
||||
+ if (esc == nullptr)
|
||||
+ break;
|
||||
+
|
||||
+ int n_read = 0;
|
||||
+ if (!skip_ansi_escape (esc, &n_read))
|
||||
+ ++esc;
|
||||
+
|
||||
+ this->stdio_file::write (buf, esc - buf);
|
||||
+ buf = esc + n_read;
|
||||
+ }
|
||||
+
|
||||
+ if (*buf != '\0')
|
||||
+ this->stdio_file::write (buf, strlen (buf));
|
||||
+}
|
||||
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
|
||||
--- a/gdb/ui-file.h
|
||||
+++ b/gdb/ui-file.h
|
||||
@@ -264,4 +264,20 @@ private:
|
||||
bool m_close_one, m_close_two;
|
||||
};
|
||||
|
||||
+/* A ui_file implementation that filters out terminal escape
|
||||
+ sequences. */
|
||||
+
|
||||
+class no_terminal_escape_file : public stdio_file
|
||||
+{
|
||||
+public:
|
||||
+ no_terminal_escape_file ()
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ /* Like the stdio_file methods, but these filter out terminal escape
|
||||
+ sequences. */
|
||||
+ void write (const char *buf, long length_buf) override;
|
||||
+ void puts (const char *linebuffer) override;
|
||||
+};
|
||||
+
|
||||
#endif
|
||||
diff --git a/gdb/ui-style.h b/gdb/ui-style.h
|
||||
--- a/gdb/ui-style.h
|
||||
+++ b/gdb/ui-style.h
|
||||
@@ -233,8 +233,8 @@ private:
|
||||
|
||||
/* Skip an ANSI escape sequence in BUF. BUF must begin with an ESC
|
||||
character. Return true if an escape sequence was successfully
|
||||
- skipped; false otherwise. In either case, N_READ is updated to
|
||||
- reflect the number of chars read from BUF. */
|
||||
+ skipped; false otherwise. If an escape sequence was skipped,
|
||||
+ N_READ is updated to reflect the number of chars read from BUF. */
|
||||
|
||||
extern bool skip_ansi_escape (const char *buf, int *n_read);
|
||||
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
gdb: Remove file path from test name
|
||||
|
||||
Having paths in test names makes comparing sum files difficult, rename
|
||||
a test to avoid paths in test names.
|
||||
|
||||
gdb/testsuite/ChangeLog:
|
||||
|
||||
* gdb.base/style-logging.exp: Remove path from test name.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp
|
||||
--- a/gdb/testsuite/gdb.base/style-logging.exp
|
||||
+++ b/gdb/testsuite/gdb.base/style-logging.exp
|
||||
@@ -38,7 +38,8 @@ save_vars { env(TERM) } {
|
||||
gdb_test_no_output "set style enabled on"
|
||||
|
||||
set log_name [standard_output_file log.txt]
|
||||
- gdb_test_no_output "set logging file $log_name"
|
||||
+ gdb_test_no_output "set logging file $log_name" \
|
||||
+ "set logging filename"
|
||||
gdb_test_no_output "set logging overwrite on"
|
||||
gdb_test "set logging on" "Copying output to .*"
|
||||
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
Don't crash if dwarf_decode_macro_bytes's 'body' is NULL
|
||||
|
||||
Hi,
|
||||
|
||||
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1708786
|
||||
|
||||
During the Fedora RPM build process, gdb-add-index is invoked to
|
||||
extract the DWARF index from the binary, and GDB will segfault because
|
||||
dwarf2read.c:parse_definition_macro's 'body' variable is NULL.
|
||||
|
||||
The underlying problem is that Fedora's rpm-build's "debugedit"
|
||||
program will silently corrupt .debug_macro strings when a binary is
|
||||
compiled with -g3. This is being taken care of by Mark Wielaard,
|
||||
here:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1708786
|
||||
|
||||
However, I still feel it's important to make GDB more resilient
|
||||
against invalid DWARF input, so I'm proposing this rather simple patch
|
||||
to catch the situation when "body == NULL" (i.e., it's probably been
|
||||
corrupted) and issue a complaint. This is not a real fix to the
|
||||
problem, of course, but at least GDB is able to finish without
|
||||
segfaulting.
|
||||
|
||||
OK for master?
|
||||
|
||||
gdb/ChangeLog:
|
||||
2019-05-15 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192
|
||||
* dwarf2read.c (dwarf_decode_macro_bytes): Check whether 'body' is
|
||||
NULL, and complain if that's the case.
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -24627,7 +24627,21 @@ dwarf_decode_macro_bytes (struct dwarf2_cu *cu,
|
||||
is_define ? _("definition") : _("undefinition"),
|
||||
line == 0 ? _("zero") : _("non-zero"), line, body);
|
||||
|
||||
- if (is_define)
|
||||
+ if (body == NULL)
|
||||
+ {
|
||||
+ /* Fedora's rpm-build's "debugedit" binary
|
||||
+ corrupted .debug_macro sections.
|
||||
+
|
||||
+ For more info, see
|
||||
+ https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */
|
||||
+ complaint (_("debug info gives %s invalid macro %s "
|
||||
+ "without body (corrupted?) at line %d "
|
||||
+ "on file %s"),
|
||||
+ at_commandline ? _("command-line") : _("in-file"),
|
||||
+ is_define ? _("definition") : _("undefinition"),
|
||||
+ line, current_file->filename);
|
||||
+ }
|
||||
+ else if (is_define)
|
||||
parse_macro_definition (current_file, line, body);
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,103 +0,0 @@
|
||||
Fix crash when using PYTHONMALLOC=debug (PR python/24742)
|
||||
|
||||
This bug was originally reported against Fedora GDB:
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1723564
|
||||
|
||||
The problem is that GDB will crash in the following scenario:
|
||||
|
||||
- PYTHONMALLOC=debug or PYTHONDEVMODE=1 is set.
|
||||
|
||||
- The Python debuginfo is installed.
|
||||
|
||||
- GDB is used to debug Python.
|
||||
|
||||
The crash looks like this:
|
||||
|
||||
$ PYTHONMALLOC=debug gdb -args python3 -c pass
|
||||
GNU gdb (GDB) Fedora 8.3-3.fc30
|
||||
Reading symbols from python3...
|
||||
Reading symbols from /usr/lib/debug/usr/bin/python3.7m-3.7.3-3.fc30.x86_64.debug...
|
||||
(gdb) run
|
||||
Starting program: /usr/bin/python3 -c pass
|
||||
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.29-9.fc30.x86_64
|
||||
Debug memory block at address p=0x5603977bf330: API ''
|
||||
8098648152243306496 bytes originally requested
|
||||
The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfb):
|
||||
at p-7: 0x03 *** OUCH
|
||||
at p-6: 0x00 *** OUCH
|
||||
at p-5: 0x00 *** OUCH
|
||||
at p-4: 0x00 *** OUCH
|
||||
at p-3: 0x00 *** OUCH
|
||||
at p-2: 0x00 *** OUCH
|
||||
at p-1: 0x00 *** OUCH
|
||||
Because memory is corrupted at the start, the count of bytes requested
|
||||
may be bogus, and checking the trailing pad bytes may segfault.
|
||||
The 8 pad bytes at tail=0x706483999ad1f330 are Segmentation fault (core dumped)
|
||||
|
||||
It's hard to determine what happens, but after doing some
|
||||
investigation and talking to Victor Stinner I found that GDB should
|
||||
not use the Python memory allocation functions before the Python
|
||||
interpreter is initialized (which makes sense). However, we do just
|
||||
that on python/python.c:do_start_initialization:
|
||||
|
||||
...
|
||||
progsize = strlen (progname.get ());
|
||||
progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t));
|
||||
...
|
||||
/* Note that Py_SetProgramName expects the string it is passed to
|
||||
remain alive for the duration of the program's execution, so
|
||||
it is not freed after this call. */
|
||||
Py_SetProgramName (progname_copy);
|
||||
...
|
||||
Py_Initialize ();
|
||||
PyEval_InitThreads ();
|
||||
|
||||
Upon reading the Python 3 C API documentation, I
|
||||
found (https://docs.python.org/3.5/c-api/memory.html):
|
||||
|
||||
To avoid memory corruption, extension writers should never try to
|
||||
operate on Python objects with the functions exported by the C
|
||||
library: malloc(), calloc(), realloc() and free(). This will result in
|
||||
mixed calls between the C allocator and the Python memory manager with
|
||||
fatal consequences, because they implement different algorithms and
|
||||
operate on different heaps. However, one may safely allocate and
|
||||
release memory blocks with the C library allocator for individual
|
||||
purposes[...]
|
||||
|
||||
And Py_SetProgramName seems like a very simple call that doesn't need
|
||||
a Python-allocated memory to work on. So I'm proposing this patch,
|
||||
which simply replaces PyMem_Malloc by xmalloc.
|
||||
|
||||
Testing this is more complicated. First, the crash is completely
|
||||
non-deterministic; I was able to reproduce it 10 times in a row, and
|
||||
then I wasn't able to reproduce it anymore. I found that if you
|
||||
completely remove your build directory and rebuild GDB from scratch,
|
||||
you can reproduce it again confidently. And with my patch, I
|
||||
confirmed that the bug doesn't manifest even in this situation.
|
||||
|
||||
No regressions found.
|
||||
|
||||
OK to apply?
|
||||
|
||||
gdb/ChangeLog:
|
||||
2019-06-28 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
PR python/24742
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1723564
|
||||
* python/python.c (do_start_initialization): Use 'xmalloc'
|
||||
instead of 'PyMem_Malloc'.
|
||||
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -1720,7 +1720,7 @@ do_start_initialization ()
|
||||
std::string oldloc = setlocale (LC_ALL, NULL);
|
||||
setlocale (LC_ALL, "");
|
||||
progsize = strlen (progname.get ());
|
||||
- progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t));
|
||||
+ progname_copy = (wchar_t *) xmalloc ((progsize + 1) * sizeof (wchar_t));
|
||||
if (!progname_copy)
|
||||
{
|
||||
fprintf (stderr, "out of memory\n");
|
||||
|
||||
12
gdb-rhbz1818011-bfd-gcc10-error.patch
Normal file
12
gdb-rhbz1818011-bfd-gcc10-error.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
|
||||
--- a/bfd/elf-bfd.h
|
||||
+++ b/bfd/elf-bfd.h
|
||||
@@ -1937,7 +1937,7 @@ struct elf_obj_tdata
|
||||
struct sdt_note *sdt_note_head;
|
||||
|
||||
Elf_Internal_Shdr **group_sect_ptr;
|
||||
- int num_group;
|
||||
+ unsigned int num_group;
|
||||
|
||||
/* Index into group_sect_ptr, updated by setup_group when finding a
|
||||
section's group. Used to optimize subsequent group searches. */
|
||||
16
gdb-rhbz1822715-fix-python-deprecation.patch
Normal file
16
gdb-rhbz1822715-fix-python-deprecation.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -1618,7 +1618,12 @@ do_start_initialization ()
|
||||
#endif
|
||||
|
||||
Py_Initialize ();
|
||||
+#if PY_VERSION_HEX < 0x03090000
|
||||
+ /* PyEval_InitThreads became deprecated in Python 3.9 and will
|
||||
+ be removed in Python 3.11. Prior to Python 3.7, this call was
|
||||
+ required to initialize the GIL. */
|
||||
PyEval_InitThreads ();
|
||||
+#endif
|
||||
|
||||
#ifdef IS_PY3K
|
||||
gdb_module = PyImport_ImportModule ("_gdb");
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user