Commit aaff1873 authored by Brendan Gregg's avatar Brendan Gregg Committed by GitHub

Merge pull request #189 from psanford/printf-stacks

Support printf("%s") for stack and ustack
parents b84eca1e 86848e6e
......@@ -354,6 +354,14 @@ std::vector<uint64_t> BPFtrace::get_arg_values(std::vector<Field> args, uint8_t*
name = strdup(resolve_name(*(uint64_t*)(arg_data+arg.offset)).c_str());
arg_values.push_back((uint64_t)name);
break;
case Type::stack:
name = strdup(get_stack(*(uint64_t*)(arg_data+arg.offset), false, 8).c_str());
arg_values.push_back((uint64_t)name);
break;
case Type::ustack:
name = strdup(get_stack(*(uint64_t*)(arg_data+arg.offset), true, 8).c_str());
arg_values.push_back((uint64_t)name);
break;
default:
abort();
}
......
......@@ -33,7 +33,8 @@ std::string verify_format_string(const std::string &fmt, std::vector<Field> args
for (int i=0; i<num_args; i++, token_iter++)
{
Type arg_type = args.at(i).type.type;
if (arg_type == Type::sym || arg_type == Type::usym || arg_type == Type::name || arg_type == Type::username)
if (arg_type == Type::sym || arg_type == Type::usym || arg_type == Type::name ||
arg_type == Type::username || arg_type == Type::stack || arg_type == Type::ustack)
arg_type = Type::string; // Symbols should be printed as strings
int offset = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment