On 2022/08/24 11:19, Lianbo Jiang wrote:
When trying to load a module with "mod -s" without its
separated debug
info file installed, the crash utility will abort as below:
crash> mod -s kpatch_test kpatch_test.ko
...
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
Aborted (core dumped)
Let's return the std::string() instead of std::string(NULL) when a
string is null, because the check_specified_kernel_debug_file() may
return NULL.
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
Thanks for the update, looks good and applied.
https://github.com/crash-utility/crash/commit/4c85e982d25a259f81b5e8c230a...
Kazu
> ---
> gdb-10.2.patch | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/gdb-10.2.patch b/gdb-10.2.patch
> index 577f5e45fc5a..f0034ed626a0 100644
> --- a/gdb-10.2.patch
> +++ b/gdb-10.2.patch
> @@ -9,6 +9,7 @@
> # to all subsequent patch applications.
>
> tar xvzmf gdb-10.2.tar.gz \
> + gdb-10.2/gdb/symfile.c \
> gdb-10.2/gdb/Makefile.in
>
> exit 0
> @@ -1650,3 +1651,13 @@ exit 0
>
> c_print_type_1 (type->field (i).type (),
> TYPE_FIELD_NAME (type, i),
> +--- gdb-10.2/gdb/symfile.c.orig
> ++++ gdb-10.2/gdb/symfile.c
> +@@ -1610,7 +1610,7 @@ find_separate_debug_file_by_debuglink (struct objfile
*objfile)
> + if (debugfile.empty ()) {
> + char *name_copy;
> + name_copy = check_specified_kernel_debug_file();
> +- return std::string (name_copy);
> ++ return name_copy ? std::string (name_copy) : std::string ();
> + }
> + #endif