Thank you for the comment, Kazu.

On Thu, Mar 9, 2023 at 12:26 PM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@nec.com> wrote:
On 2023/03/07 20:04, Lianbo Jiang wrote:
> This is a backported patch from gdb. Without the patch, the "dis -rl"
> command may abort due to an assertion failure in the gdb's
> dw2_find_pc_sect_compunit_symtab():
>
>    crash> dis -rl ffffffff96ad716c
>    dwarf2/read.c:4928: internal-error: compunit_symtab* dw2_find_pc_sect_compunit_symtab(objfile*, bound_minimal_symbol, CORE_ADDR, obj_section*, int): Assertion `result != NULL' failed.
>    A problem internal to GDB has been detected,
>    further debugging may prove unreliable.
>    Quit this debugging session? (y or n) dwarf2/read.c:4928: internal-error: compunit_symtab* dw2_find_pc_sect_compunit_symtab(objfile*, bound_minimal_symbol, CORE_ADDR, obj_section*, int): Assertion `result != NULL' failed.
>    A problem internal to GDB has been detected,
>    further debugging may prove unreliable.
>    Aborted (core dumped)
>
> The gdb commit 834eaf9201c1 ("Fix crash in new DWARF indexer")
> solved the current issue.

I think this partial backport will be fine.Few questions:

Doesn't this happen with "dis" or "dis -l" commands?

These two commands can not reproduce this issue for my side.
 
In other words, are the minimum options "dis -rl" above?

The "dis -r"  can also reproduce it.


Is there no warning and problem in the result with the patch?

 
With the patch:
crash> dis -r ffffffff96ad716c
0x0 <>: (Error: pc 0x33fff in address map, but not in symtab.)
No line number information available for address 0x33fff
crash> dis -rl ffffffff96ad716c
0x0 <>: (Internal error: pc 0x33fff in read in CU, but not in symtab.)
0x0 <>: (Error: pc 0x33fff in address map, but not in symtab.)
No line number information available for address 0x33fff

Thanks.
Lianbo
 


>
> Reported-by: Buland Kumar Singh <bsingh@redhat.com>
> Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
> ---
>   gdb-10.2.patch | 16 +++++++++++++++-
>   1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/gdb-10.2.patch b/gdb-10.2.patch
> index aa34743501ad..d762680eb472 100644
> --- a/gdb-10.2.patch
> +++ b/gdb-10.2.patch
> @@ -12,7 +12,8 @@ tar xvzmf gdb-10.2.tar.gz \
>       gdb-10.2/gdb/symtab.c \
>       gdb-10.2/gdb/printcmd.c \
>       gdb-10.2/gdb/symfile.c \
> -     gdb-10.2/gdb/Makefile.in
> +     gdb-10.2/gdb/Makefile.in \
> +     gdb-10.2/gdb/dwarf2/read.c
>   
>   exit 0
>   
> @@ -2078,3 +2079,16 @@ exit 0
>   
>      return new_type;
>    }
> +--- gdb-10.2/gdb/dwarf2/read.c.orig
> ++++ gdb-10.2/gdb/dwarf2/read.c
> +@@ -4925,7 +4925,10 @@ dw2_find_pc_sect_compunit_symtab (struct objfile *objfile,
> +   result = recursively_find_pc_sect_compunit_symtab
> +     (dw2_instantiate_symtab (data, per_objfile, false), pc);
> +
> +-  gdb_assert (result != NULL);
> ++  if (warn_if_readin && result == nullptr)
> ++    warning (_("(Error: pc %s in address map, but not in symtab.)"),
> ++            paddress (objfile->arch (), pc));
> ++
> +   return result;
> + }