[klee-dev] Klee and gmock error

Scholz, Niklas niklas.scholz at tum.de
Tue Sep 29 15:58:08 BST 2015


Hi Martin,

thanks for your mail and sorry for the delay, I was on vacation.
First of all, the problematic part of the code in gtest.cc is this one (line 9):

std::string StringStreamToString(::std::stringstream* ss) {
  const ::std::string& str = ss->str();
  const char* const start = str.c_str();
  const char* const end = start + str.length();

  std::string result;
  result.reserve(2 * (end - start));
  for (const char* ch = start; ch != end; ++ch) {
    if (*ch == '\0') {                                //  Problematic line
      result += "\\0";  // Replaces NUL with "\\0";
    } else {
      result += *ch;
    }
  }

  return result;
}

But I cannot just change something gtest.cc so the question would be is there anyway to ignore this mistake or to controll it with inputs?

Second thing is, I had problems running klee in a debugger, since I'm new to klee and not an expert in Ubuntu. Could you please tell me how to do that?

Thanks in advance,
Niklas



Am 11.09.2015 um 14:58 schrieb Martin Nowack <martin_nowack at tu-dresden.de>:

Hi,

Two things:

On 10 Sep 2015, at 16:31, Scholz, Niklas <niklas.scholz at tum.de> wrote:

KLEE: ERROR: /home/niklas/gmock-1.7.0/build/../gtest/src/gtest.cc:1667: memory error: out of bound pointer
KLEE: NOTE: now ignoring this error at this location

This is your first problem:
../gtest/src/gtest.cc:1667: memory error: out of bound pointer
There is an out-of-bound access there, please check the source code of gtest.
Maybe it's intended, maybe there is another issue.
It might be part of the gmok startup routine, so whatever application you will link against it,
it will always fail. Please take a closer look to it to discover what could be the reason.
If it's an issue with KLEE, please try to come up with a very small one-file test example (have a look at the test files under test/ directory).

KLEE: done: total instructions = 815
KLEE: done: completed paths = 1
KLEE: done: generated tests = 1
0  libLLVM-3.4.so.1 0x00007f560a25c042 llvm::sys::PrintStackTrace(_IO_FILE*) + 34
1  libLLVM-3.4.so.1 0x00007f560a25be34
2  libpthread.so.0  0x00007f560915f340
3  libpthread.so.0  0x0000000000e3f940
Segmentation fault (core dumped)
Second, this segfault is a thing which worries me.
Despite any problem in your application, KLEE shouldn't segfault.
(I assume here you use a vanilla KLEE)

Could you recompile KLEE, please make sure you use:
make DISABLE_ASSERTIONS=0 ENABLE_OPTIMIZED=1 DEBUG_SYMBOLS=1

Run KLEE in a debugger and send me the stack trace.

Thanks,

Martin


Is there a way to use gmock and klee together? Thanks in advance.

Regards,
Niklas




_______________________________________________
klee-dev mailing list
klee-dev at imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev

---------------------------------------------------
Martin Nowack
Research Assistant

Technische Universität Dresden
Computer Science
Institute of Systems Architecture
Systems Engineering
01062 Dresden

Phone: +49 351 463 39608
Email: martin_nowack at tu-dresden.de
----------------------------------------------------


-------------- next part --------------
HTML attachment scrubbed and removed


More information about the klee-dev mailing list