This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/14431] NULL/invalid char * pretty printed as "<unknown>" string
- From: "mjw at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Sat, 04 Aug 2012 22:57:54 +0000
- Subject: [Bug translator/14431] NULL/invalid char * pretty printed as "<unknown>" string
- Auto-submitted: auto-generated
- References: <bug-14431-6586@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=14431
--- Comment #1 from Mark Wielaard <mjw at redhat dot com> 2012-08-04 22:57:54 UTC ---
What about we always also add the address of a char array?
diff --git a/tapsets.cxx b/tapsets.cxx
index 1068a42..edeb30c 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -2893,18 +2893,20 @@ dwarf_pretty_print::print_chars (Dwarf_Die* start_type,
target_symbol* e,
const char *name = dwarf_diename (&type);
if (name && (name == string("char") || name == string("unsigned char")))
{
- if (push_deref (pf, "\"%s\"", e))
+ if (push_deref (pf, "\"%s\"@%p", e))
{
// steal the last arg for a string access
assert (!pf->args.empty());
+ expression* expr = pf->args.back();
functioncall* fcall = new functioncall;
fcall->tok = e->tok;
fcall->function = userspace_p ? "user_string2" : "kernel_string2";
- fcall->args.push_back (pf->args.back());
+ fcall->args.push_back (expr);
expression *err_msg = new literal_string ("<unknown>");
err_msg->tok = e->tok;
fcall->args.push_back (err_msg);
pf->args.back() = fcall;
+ pf->args.push_back (expr);
}
return true;
}
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?
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.