Skip to content

Commit 9686a44

Browse files
authored
Merge pull request #3207 from smowton/smowton/feature/jbmc-list-symbols
JBMC: support list-symbols
2 parents 084fc14 + 87581eb commit 9686a44

File tree

7 files changed

+38
-8
lines changed

7 files changed

+38
-8
lines changed
253 Bytes
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
public class Test {
3+
4+
public static void main(String[] args) {
5+
6+
}
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Test.class
3+
--list-symbols --json-ui
4+
"java::Test.main:\(\[Ljava/lang/String;\)V": \{
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
"value":
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--list-symbols
4+
^java::Test\.main:\(\[Ljava/lang/String;\)V \(struct java::array\[reference\] \*\) -> void$
5+
^EXIT=0$
6+
^SIGNAL=0$

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,12 @@ int jbmc_parse_optionst::get_goto_program(
649649
// values, etc
650650
if(cmdline.isset("show-symbol-table"))
651651
{
652-
show_symbol_table(
653-
lazy_goto_model.symbol_table, ui_message_handler);
652+
show_symbol_table(lazy_goto_model.symbol_table, ui_message_handler);
653+
return 0;
654+
}
655+
else if(cmdline.isset("list-symbols"))
656+
{
657+
show_symbol_table_brief(lazy_goto_model.symbol_table, ui_message_handler);
654658
return 0;
655659
}
656660

@@ -821,8 +825,12 @@ bool jbmc_parse_optionst::show_loaded_functions(
821825
{
822826
if(cmdline.isset("show-symbol-table"))
823827
{
824-
show_symbol_table(
825-
goto_model.get_symbol_table(), ui_message_handler);
828+
show_symbol_table(goto_model.get_symbol_table(), ui_message_handler);
829+
return true;
830+
}
831+
else if(cmdline.isset("list-symbols"))
832+
{
833+
show_symbol_table_brief(goto_model.get_symbol_table(), ui_message_handler);
826834
return true;
827835
}
828836

@@ -1056,6 +1064,7 @@ void jbmc_parse_optionst::help()
10561064
"Program representations:\n"
10571065
" --show-parse-tree show parse tree\n"
10581066
" --show-symbol-table show loaded symbol table\n"
1067+
" --list-symbols list symbols with type information\n"
10591068
HELP_SHOW_GOTO_FUNCTIONS
10601069
" --drop-unused-functions drop functions trivially unreachable\n"
10611070
" from main function\n"

jbmc/src/jbmc/jbmc_parse_options.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ class optionst;
5959
OPT_SHOW_GOTO_FUNCTIONS \
6060
OPT_SHOW_CLASS_HIERARCHY \
6161
"(show-loops)" \
62-
"(show-symbol-table)(show-parse-tree)" \
62+
"(show-symbol-table)" \
63+
"(list-symbols)" \
64+
"(show-parse-tree)" \
6365
OPT_SHOW_PROPERTIES \
6466
"(drop-unused-functions)" \
6567
"(property):(stop-on-fail)(trace)" \

src/goto-programs/show_symbol_table.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ static void show_symbol_table_brief_json_ui(
266266
if(symbol.type.is_not_nil())
267267
ptr->from_type(symbol.type, type_str, ns);
268268

269-
if(symbol.value.is_not_nil())
270-
ptr->from_expr(symbol.value, value_str, ns);
271-
272269
json_objectt symbol_json;
273270
symbol_json["prettyName"] = json_stringt(symbol.pretty_name);
274271
symbol_json["baseName"] = json_stringt(symbol.base_name);

0 commit comments

Comments
 (0)