Hi Tao,

thank you for the fix.

On 2025/06/10 18:57, Tao Liu wrote:
> There is an infinite recursion bug noticed in rust symbols. The root cause is
> unclear to me. This patch will avoid the bug by skip the recursion of rust
> symbols, since currently we don't need to deal with those.

I confirmed that the recursive dwarf_child() calls result in a loop, and 
I'm also not sure how we can avoid it correctly.  I think for now there 
is no demand for eppic + Rust with makedumpfile, so I can agree about 
skipping Rust DIEs.

I think that probably you tried to support them as much as possible, so 
the patch has the lang check in search_domain().  but a halfway support 
may be confusing, i.e. maybe a user cannot determine whether it's not 
supported or a bug.

So could we skip it in get_debug_info() like below and describe that the 
eppic extension does not support Rust's debug information in the man page?

@@ -1007,6 +1010,12 @@ get_debug_info(void)
                         ERRMSG("Can't get CU die.\n");
                         goto out;
                 }
+
+               /* NOTE: currently Rust is not supported. */
+               if (dwarf_srclang(&cu_die) == DW_LANG_Rust)
+                       continue;
+
                 search_die_tree(&cu_die, &found);
                 if (found)
                         break;

Thanks,
Kazu

> 
> Signed-off-by: Tao Liu <[email protected]>
> ---
>   dwarf_info.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/dwarf_info.c b/dwarf_info.c
> index a3a2fd6..73842ab 100644
> --- a/dwarf_info.c
> +++ b/dwarf_info.c
> @@ -837,7 +837,7 @@ search_symbol(Dwarf_Die *die, int *found)
>   }
>   
>   static void
> -search_domain(Dwarf_Die *die, int *found)
> +search_domain(Dwarf_Die *die, int *found, int lang)
>   {
>       int tag;
>       const char *name;
> @@ -859,10 +859,11 @@ search_domain(Dwarf_Die *die, int *found)
>                       if (is_container(&die_type)) {
>                               Dwarf_Die child;
>   
> -                             if (dwarf_child(&die_type, &child) != 0)
> +                             if (dwarf_child(&die_type, &child) != 0 ||
> +                                 lang == DW_LANG_Rust)
>                                       continue;
>   
> -                             search_domain(&child, found);
> +                             search_domain(&child, found, lang);
>   
>                               if (*found)
>                                       return;
> @@ -924,7 +925,7 @@ search_die(Dwarf_Die *die, int *found)
>   }
>   
>   static void
> -search_die_tree(Dwarf_Die *die, int *found)
> +search_die_tree(Dwarf_Die *die, int *found, int lang)
>   {
>       Dwarf_Die child;
>   
> @@ -932,7 +933,7 @@ search_die_tree(Dwarf_Die *die, int *found)
>        * start by looking at the children
>        */
>       if (dwarf_child(die, &child) == 0)
> -             search_die_tree(&child, found);
> +             search_die_tree(&child, found, lang);
>   
>       if (*found)
>               return;
> @@ -950,7 +951,7 @@ search_die_tree(Dwarf_Die *die, int *found)
>               search_typedef(die, found);
>   
>       else if (is_search_domain(dwarf_info.cmd))
> -             search_domain(die, found);
> +             search_domain(die, found, lang);
>   
>       else if (is_search_die(dwarf_info.cmd))
>               search_die(die, found);
> @@ -1007,7 +1008,7 @@ get_debug_info(void)
>                       ERRMSG("Can't get CU die.\n");
>                       goto out;
>               }
> -             search_die_tree(&cu_die, &found);
> +             search_die_tree(&cu_die, &found, dwarf_srclang(&cu_die));
>               if (found)
>                       break;
>               off = next_off;
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to