public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "jistone at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/14431] NULL/invalid char * pretty printed as "<unknown>" string
Date: Sun, 05 Aug 2012 20:29:00 -0000	[thread overview]
Message-ID: <bug-14431-6586-B5rkC0shDu@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14431-6586@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=14431

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jistone at redhat dot com

--- Comment #2 from Josh Stone <jistone at redhat dot com> 2012-08-05 20:29:44 UTC ---
(In reply to comment #1)
> What about we always also add the address of a char array?
[...]
> For our contrived example above that would give:
> 
> {.foo=""@0xcb4010, .foo_size=42, .bar=""@0xcb4050, .bar_size=47}
> {.foo="<unknown>"@0x0, .foo_size=42, .bar="<unknown>"@0x2a, .bar_size=0}
> 
> Does that look reasonable or silly?

It's tough to automagically do The Right Thing without knowing what the user is
looking for.  And in some cases, especially with kernel pointers, the %p may
overshadow the actual string, something like:

> {.foo=""@0xffffffffffcb4010, .foo_size=42, .bar=""@0xffffffffffcb4050, .bar_size=47}

Rather than trying both string value and address every time, maybe we should
make new kernel/user_string variants that return either a quoted string *or* a
pointer value, e.g. "\"foo\"" or "0x2a" depending on whether it's readable. 
Maybe "?@0x2a" to indicate it was tried but couldn't be read.  Your examples
would be:

> {.foo="", .foo_size=42, .bar="", .bar_size=47}
> {.foo=?@0x0, .foo_size=42, .bar=?@0x2a, .bar_size=0}

We can only try to be just so smart... for people who know they want something
different, like all pointer addresses, they can always roll their own
pretty-print.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

  parent reply	other threads:[~2012-08-05 20:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03 10:30 [Bug translator/14431] New: " mjw at redhat dot com
2012-08-04 22:58 ` [Bug translator/14431] " mjw at redhat dot com
2012-08-05 20:29 ` jistone at redhat dot com [this message]
2012-08-06  8:43 ` [Bug translator/14431] char * always being printed as, possibly INVALID/NULL "<unknown>", string without giving actual address mjw at redhat dot com
2012-08-06 15:32 ` mjw at redhat dot com
2012-08-06 17:24 ` jistone at redhat dot com
2012-08-06 18:59 ` mjw at redhat dot com
2015-10-21 18:50 ` fche at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14431-6586-B5rkC0shDu@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).