[Ltrace-devel] [PATCH 8/8] mipsel: Update breakpoints when functions return

Petr Machata pmachata at redhat.com
Wed Sep 26 23:38:03 UTC 2012


edgar.iglesias at gmail.com writes:

> From: "Edgar E. Iglesias" <edgar at axis.com>
>
> When functions return we check if the symbol went from
> unresolved to resolved and if the resolved address
> differs from the unresolved one. If so, we add a new
> breakpoint at the resolved address.

I'll need to think about this one.  I believe the proper way to handle
this is to add on_hit callback to return pointer.  That is not possible
now, return breakpoints are not configurable, but it seems like a more
systematic extension.  Backends can configure details of entry
breakpoints, so let's let backends customize return breakpoints as well.
Or, not even backends, but breakpoints themselves should have a hook
that is called when we wish to obtain a return breakpoint.
E.g. systemtap probes (which I'd like to support eventually) have no
sensible return address, there's no return to trace.

But that means we would need to be able to keep several breakpoints per
address.  Of course ltrace ought to be able to do this anyway, but
currently it isn't, and I don't feel like doing more major changing
before 0.7.0 is out.

Ho hum.  Let's have it your way, I'll return to this after 0.7.0.

(The above is essentially a convoluted way of saying fine, acceptable
overall.)

> @@ -624,6 +631,8 @@ handle_breakpoint(Event *event)
>  				    || prev->return_addr != brk_addr)
>  					break;
>  
> +				arch_symbol_ret(event->proc,
> +						prev->c_un.libfunc);
>  				output_right_tos(event->proc);
>  				callstack_pop(event->proc);
>  			}

The comment above this block is now wrong, PPC64 doesn't trace entry
points for -e.  But MIPS does, so the comment should be changed.

> @@ -174,6 +174,45 @@ arch_elf_destroy(struct ltelf *lte)
>  {
>  }
>  
> +/* When functions return we check if the symbol needs an updated
> +   breakpoint with the resolved address.  */
> +void arch_symbol_ret(struct Process *proc, struct library_symbol *libsym)
[...]
> +	bp = malloc (sizeof *bp);

No space before parenthesis.  Parentheses around *bp.

Thanks,
PM



More information about the Ltrace-devel mailing list