fix error crash while constructing error term
This commit is contained in:
parent
ca2cd734a2
commit
703ac35735
14
C/errors.c
14
C/errors.c
@ -361,7 +361,7 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
CELL nt[3];
|
CELL nt[3];
|
||||||
Functor fun;
|
Functor fun;
|
||||||
bool serious;
|
bool serious;
|
||||||
Term tf, error_t, comment, culprit;
|
Term tf, error_t, comment, culprit = TermNil;
|
||||||
char *format;
|
char *format;
|
||||||
char s[MAXPATHLEN];
|
char s[MAXPATHLEN];
|
||||||
|
|
||||||
@ -527,6 +527,8 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (type != ABORT_EVENT) {
|
if (type != ABORT_EVENT) {
|
||||||
|
Term location;
|
||||||
|
|
||||||
/* This is used by some complex procedures to detect there was an error */
|
/* This is used by some complex procedures to detect there was an error */
|
||||||
if (IsAtomTerm(nt[0])) {
|
if (IsAtomTerm(nt[0])) {
|
||||||
strncpy(LOCAL_ErrorSay, (char *) RepAtom(AtomOfTerm(nt[0]))->StrOfAE,
|
strncpy(LOCAL_ErrorSay, (char *) RepAtom(AtomOfTerm(nt[0]))->StrOfAE,
|
||||||
@ -538,13 +540,13 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
MAX_ERROR_MSG_SIZE);
|
MAX_ERROR_MSG_SIZE);
|
||||||
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
||||||
}
|
}
|
||||||
|
nt[1] = TermNil;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RESOURCE_ERROR_HEAP:
|
case RESOURCE_ERROR_HEAP:
|
||||||
case RESOURCE_ERROR_STACK:
|
case RESOURCE_ERROR_STACK:
|
||||||
case RESOURCE_ERROR_TRAIL:
|
case RESOURCE_ERROR_TRAIL:
|
||||||
comment = MkAtomTerm(Yap_LookupAtom(tmpbuf));
|
comment = MkAtomTerm(Yap_LookupAtom(tmpbuf));
|
||||||
default:
|
default:
|
||||||
nt[1] = TermNil;
|
|
||||||
if (comment != TermNil)
|
if (comment != TermNil)
|
||||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("i")), comment),
|
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("i")), comment),
|
||||||
nt[1]);
|
nt[1]);
|
||||||
@ -557,12 +559,12 @@ yamop *Yap_Error__(const char *file, const char *function, int lineno,
|
|||||||
nt[1] =
|
nt[1] =
|
||||||
MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("c")), t3), nt[1]);
|
MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("c")), t3), nt[1]);
|
||||||
}
|
}
|
||||||
if ((culprit = Yap_pc_location(P, B, ENV)) != TermNil) {
|
if ((location = Yap_pc_location(P, B, ENV)) != TermNil) {
|
||||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")), culprit),
|
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("p")), location),
|
||||||
nt[1]);
|
nt[1]);
|
||||||
}
|
}
|
||||||
if ((culprit = Yap_env_location(CP, B, ENV, 0)) != TermNil) {
|
if ((location = Yap_env_location(CP, B, ENV, 0)) != TermNil) {
|
||||||
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")), culprit),
|
nt[1] = MkPairTerm(MkPairTerm(MkAtomTerm(Yap_LookupAtom("e")), location),
|
||||||
nt[1]);
|
nt[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1924,6 +1924,8 @@ static Term build_bug_location(yamop *codeptr, PredEntry *pe) {
|
|||||||
} else
|
} else
|
||||||
p[4] = MkIntTerm(0);
|
p[4] = MkIntTerm(0);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
p[4] = MkIntTerm(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (pe->OpcodeOfPred == UNDEF_OPCODE) {
|
} else if (pe->OpcodeOfPred == UNDEF_OPCODE) {
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
set (JPL_SOURCES
|
set (JPL_SOURCES
|
||||||
src/c/jpl.c)
|
src/c/jpl.c)
|
||||||
|
|
||||||
macro_optional_find_package(Java ON)
|
find_package(Java COMPONENTS Runtime Development)
|
||||||
find_package(Java )
|
|
||||||
# find_package(Java COMPONENTS Development)
|
# find_package(Java COMPONENTS Development)
|
||||||
# find_package(Java COMPONENTS Runtime)
|
# find_package(Java COMPONENTS Runtime)
|
||||||
#find_package(JavaLibs)
|
#find_package(JavaLibs)
|
||||||
@ -12,7 +11,7 @@ macro_log_feature (Java_Development_FOUND "Java"
|
|||||||
"Use Java System"
|
"Use Java System"
|
||||||
"http://www.java.org" FALSE)
|
"http://www.java.org" FALSE)
|
||||||
|
|
||||||
if (Java_FOUND)
|
if (Java_Development_FOUND)
|
||||||
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
|
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
|
||||||
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
|
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
|
||||||
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
|
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
|
||||||
@ -79,4 +78,4 @@ if (Java_FOUND)
|
|||||||
)
|
)
|
||||||
endif(JNI_FOUND)
|
endif(JNI_FOUND)
|
||||||
|
|
||||||
endif (Java_FOUND)
|
endif (Java_Development_FOUND)
|
||||||
|
Reference in New Issue
Block a user