Skip to content

move setup_unwind to parse_unwindset_options to prevent duplication #2167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2018

Conversation

kroening
Copy link
Member

@kroening kroening commented May 8, 2018

No description provided.

@kroening kroening requested a review from smowton as a code owner May 8, 2018 13:08
Copy link
Member

@peterschrammel peterschrammel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smowton
Copy link
Contributor

smowton commented May 10, 2018

I think if the method is specific to configuring symex_bmct is should be defined on symex_bmct. Otherwise lgtm.

@tautschnig
Copy link
Collaborator

Echoing what @peterschrammel - my assumption had been that a key point of this PR was to re-use the existing implementation that @peterschrammel pointed out. With the work that @danpoe had done in implementing the static unwinder it's not actually specific to anything doing symbolic execution anymore. Indeed it might be adequate to move the bits from goto-instrument to goto-programs.

@kroening
Copy link
Member Author

Now in a separate data structure, which enables use in goto-instrument as well

@kroening kroening force-pushed the parse_unwindset_options branch 2 times, most recently from 90924e6 to 1270225 Compare May 12, 2018 13:27
Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great work, making code a lot cleaner. My comments mostly suggest even more cleanup that would well fit this PR.

@@ -17,6 +17,8 @@ Author: Daniel Kroening, [email protected]

#include <util/source_location.h>
#include <util/simplify_expr.h>
#include <util/string_utils.h>
#include <util/string2int.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering: are those still needed here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, gone

}

abort_unwind_decision = tvt(unwind >= this_loop_limit);
abort_unwind_decision = tvt(unwind >= *limit);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the very same code exists twice: how about adding a tvt unwindsett::limit_reached(id, thread_nr, unwind)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not easy, "this_loop_limit" is used later, and those handlers want the function name, not the loop ID

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I want to get rid of the handlers, BTW, that is the whole point of overloading those methods in goto-symex)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand. Lines 132...137 are, except for source.thread_nr vs thread_nr, exactly the same as lines 175..180.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which, btw, changes the behaviour: in the previous code, one used >= in the comparison, while the other used >. (I'm not sure they actually should be different...)

void unwindsett::parse_unwind(const std::string &unwind)
{
if(!unwind.empty())
global_limit=unsafe_string2unsigned(unwind);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have gone for the safe variant, in particular as it is user-provided input.

unwind_sett unwind_set;

if(unwindset_file)
if(unwindset_file_given)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to move all this code to unwindset.cpp as well? *parse_options tends to be way too big anyway...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that adds to the complexity of all users, say jbmc, cbmc; mildly reluctant

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear: I mainly wanted the code to move, not necessarily add that to the external user interface. Factoring out what belongs together would have seemed like a good idea?!

But also: It might actually be desirable to open up this additional option to all users?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, done

@kroening kroening force-pushed the parse_unwindset_options branch 4 times, most recently from e98e447 to 6ad505e Compare May 12, 2018 17:41
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable -- if you're killing the handlers in the future though, please do retain some way for the driver program to provide special unwind information, as its language-specific understanding can give us a concrete bound for a particular loop.

@kroening kroening force-pushed the parse_unwindset_options branch 2 times, most recently from 8ded6e5 to 5846362 Compare May 14, 2018 09:09
@tautschnig
Copy link
Collaborator

(This also needs a rebase, commits that have already been merged into develop have crept in.)

@kroening kroening force-pushed the parse_unwindset_options branch from 5846362 to 8fd52ca Compare May 14, 2018 13:25
@kroening
Copy link
Member Author

Rebase done

@kroening kroening force-pushed the parse_unwindset_options branch 2 times, most recently from 27a6fed to de9c170 Compare May 14, 2018 14:34
}

abort_unwind_decision = tvt(unwind>this_loop_limit);
abort_unwind_decision = tvt(unwind >= *limit);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change still bothers me: the previous code used > instead of >= here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmhmhm.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The counting seems to be different for recursion and loops. Restoring >.

@kroening kroening force-pushed the parse_unwindset_options branch from de9c170 to f1b6174 Compare May 18, 2018 11:29
Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(redundantly) approving under the assumption of the > vs. >= fix.

@kroening kroening merged commit 514a0a5 into develop May 18, 2018
@kroening kroening deleted the parse_unwindset_options branch May 18, 2018 14:59
NathanJPhillips pushed a commit to NathanJPhillips/cbmc that referenced this pull request Aug 22, 2018
31ef182 Merge pull request diffblue#2208 from diffblue/cleanout-goto-programs
0e84d3e Merge pull request diffblue#2195 from smowton/smowton/feature/smarter-reachability-slicer
c801126 Merge pull request diffblue#2209 from diffblue/travis-no-osx-g++
3487bf7 Reachability slicer: mark reachable code more precisely
85e8451 Merge pull request diffblue#2066 from tautschnig/bv-endianness
5e5eafb Merge pull request diffblue#2191 from smowton/smowton/feature/java-fatal-assertions
8a68ab8 remove g++ build on OS X; this is identical to the clang++ build
48e5b25 Amend faulty long-string test
3f718ba Java: make null-pointer and similar checks fatal
821eb1d remove basic_blocks and goto_program_irep
d87c2db Merge pull request diffblue#2203 from diffblue/typed-lookup
d77dea3 strongly type the lookup() methods in namespacet
2382f27 Merge pull request diffblue#2193 from martin-cs/feature/correct-instruction-documentation
c314272 Merge pull request diffblue#2181 from diffblue/format-expr-constants
514a0a5 Merge pull request diffblue#2167 from diffblue/parse_unwindset_options
0102452 move escape(s) to string_utils
f1b6174 use unwindsett in goto-instrument
dcc907a introduce unwindsett for unwinding limits
10aeae8 format_expr now does index, c_bool constants, string constants
92b92d6 Correct the documentation of ASSERT : it does not alter control flow.
a11add8 Expand the documentation of the goto-program instructions.
a06503b Merge pull request diffblue#2197 from tautschnig/fix-help
05e4bc3 Remove stray whitespace previously demanded by clang-format
3261f4d Fix help output of --generate-function-body-options
7c67b23 Merge pull request diffblue#2110 from tautschnig/type-mismatch-exception
18fb262 Merge pull request diffblue#2025 from tautschnig/stack-depth-fix
9191b6a Merge pull request diffblue#2199 from tautschnig/simplifier-typing
f99e631 Merge pull request diffblue#2198 from tautschnig/fix-test-desc
1a79a11 stack depth instrumentation: __CPROVER_initialize may be empty
a7690ba Merge pull request diffblue#2185 from smowton/smowton/fix/tolerate-ts18661-types
fc02e8f Restore returns before writing the simplified binary
49333eb Make restore_returns handle simplified programs
46f7987 Fix perl regular expressioons in regression test descriptions
9fe432b Merge pull request diffblue#1899 from danpoe/sharing-map-catch-unit-tests
9cc6aae Merge pull request diffblue#2081 from hannes-steffenhagen-diffblue/floating_point_simplificiation
da19abe Tolerate TS 18661 (_Float32 et al) types
a055454 Try all rounding modes when domain is unknown
5f7bc15 Add float support to constant propagator domain
3dc2244 Move adjust_float_expressions to goto-programs
06d8bea Merge pull request diffblue#2187 from diffblue/move-convert-nondet
6d8c3fa Merge pull request diffblue#2189 from thk123/bugfix/json-parser-restart
2ad157f Merge pull request diffblue#2186 from smowton/smowton/fix/call-graph-uninit-field
cd54ad7 Corrected state persistence in the json parser
4447be0 Fix uninitialised collect_callsites field in call_grapht
ead0aa3 Merge pull request diffblue#2188 from smowton/smowton/fix/init-string-types-without-refine-strings
57988fc Fix String type initialisation when --refine-strings is not active
6a76aff Move convert_nondet to java_bytecode
ac6eb21 Merge pull request diffblue#1858 from danpoe/dependence-graph-fix
10b8b09 Merge pull request diffblue#2011 from thomasspriggs/final_classes
a154593 Merge pull request diffblue#2087 from danpoe/feature/small-map
7002909 More dependence graph tests
66263ea Make dependence graph merge() return true when abstract state changes
3aa6dca Control dependency computation fix
a408423 Simplified state merging in the dependence graph
0315816 Merge pull request diffblue#2180 from thomasspriggs/json_id2string
8941567 Merge pull request diffblue#2124 from smowton/smowton/feature/fallback-function-provider
cd04e70 JBMC: use simple method stubbing pass
a6b2cda Add Java simple method stubbing pass
ec1127c Lazy goto model: hook for driver program to replace or stub functions
b6a4382 Remove `id2string` from inside calls to the `json_stringt` constructor.
b673ebb Add storage of final modifier status of java classes in `java_class_typet`.
a2ad909 Small map
808dade Provide suitable diagnostics for equality-without-matching-types
89cf6fe Throw appropriate exceptions when converting constraints
2ae66c2 Produce a proper error message when catching a std::runtime_error at top level
e7b3ade Workaround for Visual Studio loss of CV qualifier bug
1f661f5 Move sharing map and sharing node unit tests to util
47463a3 Use std::size_t instead of unsigned in the sharing map
3e22217 Sharing map documentation
e54f740 Fix sharing map compiler warnings
bcc489c Move sharing map unit tests to catch
34114b8 Use a specialised endianness map for flattening

git-subtree-dir: cbmc
git-subtree-split: 31ef182
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants