This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] stack: fix gdb.dwarf2/dw2-undefined-ret-addr.exp regression

> -----Original Message-----
> From: Yao Qi []
> Sent: Thursday, October 6, 2016 11:32 AM
> To: Metzger, Markus T <>
> Cc:;;
> Subject: Re: [PATCH] stack: fix gdb.dwarf2/dw2-undefined-ret-addr.exp
> regression

Hi Yao,

Thanks for your review.

> It is good to me.  I read this patch several times since July, because
> of something else in a038fa3e14a4.  Do we need to move
> frame_unwind_caller_id into try block? like this,
>   TRY
>    {
>       if (!frame_id_p (frame_unwind_caller_id (fi)))
>          val_print_unavailable (gdb_stdout);
>       else
>        {
>           caller_pc = frame_unwind_caller_pc (fi);
>           caller_pc_p = 1;
>        }
>    }
>   CATCH (ex, ....)
> frame_unwind_caller_id calls get_prev_frame_always which only catches
> MEMORY_ERROR.  IIUC, get_prev_frame_always and it callees may throw

I didn't say that get_prev_frame_always may throw NOT_AVAILABLE_ERROR.
I said that I would treat the case where the trace ends with tailcall frames without
an actual caller frame like NOT_AVAILABLE_ERROR (and this patch is changing this

The problem was that get_prev_frame_always may return NULL, which
skip_artificial_frames did not handle, causing GDB to crash.  We didn't really have
such a case before, but with record-btrace, you could end up with a bunch of
tailcall frames where the actual caller is not contained in the trace.

Pedro suggested that:  "
All the frame_unwind_caller_XXX methods should retrieve information
about the same frame that frame_unwind_caller_id returns.  They should
all really be guarded by a frame_unwind_caller_id check, like:

      if (frame_id_p (frame_unwind_caller_id (frame)))

As to whether the callers of frame_unwind_caller_id need to expect an exception,
I can't say for sure but I don't think it likely.  There are a few such checks in GDB
already and none of them seems to expect an exception.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0,
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]