Skip to content

Commit

Permalink
Merge pull request diffblue#568 from diffblue/jd/feature/adding_UI_fr…
Browse files Browse the repository at this point in the history
…iendly_method_name

Adds a 'pretty_name' value to error_traces.json
  • Loading branch information
JohnDumbell authored Aug 24, 2018
2 parents a03637f + a5e3151 commit c696d88
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/taint-instrumenter/instrumentation_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,23 @@ static void save_goto_binary_description(

for(const auto loc_id : props.get_sinks())
{
const auto &loc = props.get_location_props()
.at(loc_id)
.get_instruction_id()
->source_location;

if(seen_sinks.insert(
sink_loct{loc.get_file(), loc.get_function(), loc.get_line()}).second)
const auto &location_prop = props.get_location_props().at(loc_id);
const auto &source_loc =
location_prop.get_instruction_id()->source_location;

if(
seen_sinks
.insert(
sink_loct{source_loc.get_file(),
source_loc.get_function(),
source_loc.get_line()})
.second)
{
json_objectt jloc;
jloc["file"] = json_stringt(id2string(loc.get_file()));
jloc["function"] = json_stringt(id2string(loc.get_function()));
jloc["line"] = json_numbert(id2string(loc.get_line()));
jloc["file"] = json_stringt(id2string(source_loc.get_file()));
jloc["function"] = json_stringt(id2string(source_loc.get_function()));
jloc["line"] = json_numbert(id2string(source_loc.get_line()));
jloc["display_name"] = json_stringt(location_prop.get_pretty_name());

jsinks.push_back(jloc);
}
Expand Down
4 changes: 4 additions & 0 deletions src/taint-instrumenter/instrumentation_props.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ taint_instrumentation_propst::taint_instrumentation_propst(
{
sinks.insert(location_props.size());
}

const symbolt *function_symbol =
program.get_symbol_table().lookup(fn_vec.first);
location_props.push_back(
{rid_and_map.first,
fn_vec.first,
id2string(function_symbol->pretty_name),
iit,
assumption,
turn_on,
Expand Down
8 changes: 8 additions & 0 deletions src/taint-instrumenter/instrumentation_props.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

typedef std::string taint_function_idt;
typedef std::string taint_datatype_idt;
typedef std::string taint_pretty_function_idt;
typedef goto_programt::instructionst::const_iterator taint_instruction_idt;

class argidx_and_tokennamet
Expand Down Expand Up @@ -64,12 +65,14 @@ class taint_instrumentation_propst
location_propst(
const taint_rule_idt &_rule_id,
const taint_function_idt &_function_id,
const taint_pretty_function_idt &_pretty_function_name,
const taint_instruction_idt &_instruction_id,
const std::vector<argidx_and_tokennamet> &_assumption,
const std::vector<argidx_and_tokennamet> &_turn_on,
const std::vector<argidx_and_tokennamet> &_turn_off)
: rule_id(_rule_id),
function_id(_function_id),
pretty_function_name(_pretty_function_name),
instruction_id(_instruction_id),
assumption(_assumption),
turn_on(_turn_on),
Expand All @@ -85,6 +88,10 @@ class taint_instrumentation_propst
{
return function_id;
}
const taint_pretty_function_idt &get_pretty_name() const
{
return pretty_function_name;
}
const taint_instruction_idt &get_instruction_id() const
{
return instruction_id;
Expand All @@ -105,6 +112,7 @@ class taint_instrumentation_propst
private:
taint_rule_idt rule_id;
taint_function_idt function_id;
taint_pretty_function_idt pretty_function_name;
taint_instruction_idt instruction_id;
std::vector<argidx_and_tokennamet> assumption;
std::vector<argidx_and_tokennamet> turn_on;
Expand Down

0 comments on commit c696d88

Please sign in to comment.