This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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: stp_exit change


On Wed, 2006-01-11 at 15:33 -0500, Frank Ch. Eigler wrote:
> Hi -
> 
> hunt wrote:
> 
> > [...]
> > int get_value() {
> >    ...
> >    if (something really bad and unexpected happens) {
> > 	stp_error("bad mojo")
> > 	return 0;
> >    }
> >    return val;
> > }
> > [...]
> 
> What are some existing examples of this?  How is the caller supposed
> to know that something "fatal" occurred if not by rc?

One example, is all the map sets.
  _stp_map_set_isi (global_x, l->__tmp6, l->__tmp7, l->__tmp9);

needs to be changed to something like
  rc = _stp_map_set_isi (global_x, l->__tmp6, l->__tmp7, l->__tmp9);
  if (rc) {
    atomic_set (&session_state, STAP_SESSION_ERROR);
    if (rc == -1)
        _stp_error("map overflow at %s\n", probe_point);
    else
        _stp_error("internal error: bad args to _stp_map_set\n");
    goto out;
  }

This will not help our compile times or performance and it will have no
advantage over letting the runtime directly call stp_error(). Yes,
things continue on through the probe like the map set happened
successfully, but the worst thing that could happen is that something
later tries to read that same map node and it gets 0.

An alternative would use stp_error() calls in the runtime, but still
have the translator check rc and exit the probe immediately.
  if (_stp_map_set_isi (global_x, l->__tmp6, l->__tmp7, l->__tmp9))
    goto out;




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