about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-10-19 06:47:07 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-03-05 17:31:13 +0900
commitbe10b1d4179db60fc1295be58626c3467c744efd (patch)
treeb01f0746d8d92e98def940df130f257dabfe2ff2
parent10e4dd58331b0dc316c9cf2969f50dc7d74e313d (diff)
downloadklee-be10b1d4179db60fc1295be58626c3467c744efd.tar.gz
Handle revisited meta sym var when generate env var
I still have no clue in some cases why they are seen more than once.
-rw-r--r--lib/Core/ExecutionState.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Core/ExecutionState.cpp b/lib/Core/ExecutionState.cpp
index 3f92cccd..d6639208 100644
--- a/lib/Core/ExecutionState.cpp
+++ b/lib/Core/ExecutionState.cpp
@@ -419,7 +419,10 @@ std::string extractMetaEnvVar(ref<Expr> e) {
     return "";
   std::string value;
   constant->toString(value);
-  return "__SWITCH" + name.substr(8, name.size() - 8) + "=" + value;
+  unsigned char count = 1;
+  while (count < name.size() - 8 && name[count + 8] != '_')
+    ++count;
+  return "__SWITCH" + name.substr(8, count) + "=" + value;
 }
 
 void ExecutionState::addConstraint(ref<Expr> e) {