diff --git a/defs.h b/defs.h index a2032a2f..1e24e604 100644 --- a/defs.h +++ b/defs.h @@ -7933,6 +7933,7 @@ extern unsigned char *gdb_prettyprint_arrays; extern unsigned int *gdb_repeat_count_threshold; extern unsigned char *gdb_stop_print_at_null; extern unsigned int *gdb_output_radix; +int is_kvaddr(ulong); /* * gdb/top.c diff --git a/gdb-10.2.patch b/gdb-10.2.patch index 0bed96a3..a9ad0c39 100644 --- a/gdb-10.2.patch +++ b/gdb-10.2.patch @@ -16171,3 +16171,32 @@ exit 0 } /* +--- gdb-10.2/gdb/stack.c.orig ++++ gdb-10.2/gdb/stack.c +@@ -1990,6 +1990,10 @@ + /* Print briefly all stack frames or just the innermost COUNT_EXP + frames. */ + ++#ifdef CRASH_MERGE ++extern "C" int is_kvaddr(ulong); ++#endif ++ + static void + backtrace_command_1 (const frame_print_options &fp_opts, + const backtrace_cmd_options &bt_opts, +@@ -2082,6 +2086,15 @@ + hand, perhaps the code does or could be fixed to make sure + the frame->prev field gets set to NULL in that case). */ + ++#ifdef CRASH_MERGE ++ CORE_ADDR pc = 0; ++ get_frame_pc_if_available (fi, &pc); ++ if (!is_kvaddr(pc)) { ++ printf_filtered (_("Backtrace stopped due to non-kernel addr: %lx\n"),pc); ++ fi = NULL; ++ break; ++ } ++#endif + print_frame_info (fp_opts, fi, 1, LOCATION, 1, 0); + if ((flags & PRINT_LOCALS) != 0) + { diff --git a/gdb_interface.c b/gdb_interface.c index 7399fd0a..2965a100 100644 --- a/gdb_interface.c +++ b/gdb_interface.c @@ -947,6 +947,12 @@ gdb_lookup_module_symbol(ulong addr, ulong *offset) } } +int +is_kvaddr(ulong addr) +{ + return IS_KVADDR(addr); +} + /* * Used by gdb_interface() to catch gdb-related errors, if desired. */