MCPcopy Create free account
hub / github.com/R-Fuzz/symsan / ExportTaskSMT2

Function ExportTaskSMT2

python/symsan-py.cpp:582–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582static PyObject* ExportTaskSMT2(PyObject *self, PyObject *args) {
583 if (__z3_parser == nullptr) {
584 PyErr_SetString(PyExc_RuntimeError, "parser not initialized");
585 return NULL;
586 }
587
588 uint64_t id = 0;
589 const char *filename = NULL;
590 if (!PyArg_ParseTuple(args, "Ks", &id, &filename)) {
591 return NULL;
592 }
593
594 int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
595 if (fd < 0) {
596 PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
597 return NULL;
598 }
599
600 int ret = __z3_parser->export_task_smt2(id, fd);
601 close(fd);
602
603 if (ret != 0) {
604 PyErr_SetString(PyExc_RuntimeError, "failed to export task as SMT2");
605 return NULL;
606 }
607
608 Py_RETURN_NONE;
609}
610
611static PyMethodDef SymSanMethods[] = {
612 {"init", (PyCFunction)SymSanInit, METH_VARARGS | METH_KEYWORDS, "initialize symsan target"},

Callers

nothing calls this directly

Calls 3

openFunction · 0.85
closeFunction · 0.85
export_task_smt2Method · 0.80

Tested by

no test coverage detected