This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [Bug tapsets/2861] user_string fault handling
On Thu, 2006-06-29 at 01:08 +0000, fche at redhat dot com wrote:
>
> > user_string(addr, 0) ==> same as above but prints warning
>
> The ", 0" setting is not helpful (nor is the "0" too informative). We
> don't print run-time warnings at the present, and for good reason: they
> are only noise.
Unless, of course, you are interested in that "noise". As a developer I
often want to see it.
> > user_string(addr, 1) ==> prints error message and sets lasterr
>
> I don't find the ", 1" is too informative.
How is it less informative than user_string2() as you proposed? I was
thinking it would be better to have parameters that modify the functions
behavior than lots of functions that do almost the same thing.
OK, here is what I am going to do for now.
user_string(addr:long) - returns "<unknown>" on error, otherwise no
warnings, errors, etc. This is simplest and cleanest and will satisfy
99.99% of uses.
user_string2(addr:long, err_msg:string) - Those who want to check for
errors and are afraid that files named "<unknown>" might confuse their
script can use this and give it something less likely to be a valid
filename or data. This could be renamed to user_string() too if/when we
change the translator.
user_string_warn(addr:long) - For debugging/developers. If copies are
failing often, maybe we want some more details. Not likely to be used
much, but I sometimes use something like it.