簡體   English   中英

如何修復 CLIPS 的“ProfileInfoCommand”的核心轉儲?

[英]How to fix the coredump for 'ProfileInfoCommand' of CLIPS?

剪輯版本: 6.31
語言: c++ clips C API

EnvRun之后執行ProfileInfoCommand時,我得到一個核心轉儲文件。
為什么會發生此錯誤? 這里有使用錯誤嗎? 或者這是一個錯誤?

c++ 代碼 1:

#define PROFILING_FUNCTIONS 1

// ...

EnvReset(clips);

// ...
EnvLoadFactsFromString(clips, facts.str().c_str(), -1);
// ...

EnvRun(clips, 100000);
ProfileInfoCommand(clips);

我知道如果PROFILING_FUNCTIONS定義為 1, EnvRun function 將自動啟動配置文件。所以我在EnvRun之后使用ProfileInfoCommand ,但發生了核心轉儲!

我也嘗試使用另一種方法,但該過程也生成了核心轉儲(與the c++ code 1相同的回溯)。
c++ 代碼 2:

EnvReset(clips);
Profile(clips, "constructs");

// ...
EnvLoadFactsFromString(clips, facts.str().c_str(), -1);
// ...

EnvRun(clips, max_iters);
Profile(clips, "off");
ProfileInfoCommand(clips);

核心轉儲文件如下:

Core was generated by `/mnt/home/worker/project/ae-arbiter/dist/bin/arbiter-8003 --flagfile=flags.'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000bc6b80 in EnvRtnArgCount (theEnv=Cannot access memory at address 0x7f879c3f6af8
) at /mnt/home/worker/project/ae-arbiter/src/clips/argacces.cc:306
306    for (argPtr = EvaluationData(theEnv)->CurrentExpression->argList;
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.el6.x86_64
(gdb) bt
#0  0x0000000000bc6b80 in EnvRtnArgCount (theEnv=0x7f85e6454f70) at /mnt/home/worker/project/ae-arbiter/src/clips/argacces.cc:306
#1  0x0000000000bc6bcd in EnvArgCountCheck (theEnv=0x7f85e6454f70, functionName=0xda1188 "profile", countRelation=2, expectedNumber=1) at /mnt/home/worker/project/ae-arbiter/src/clips/argacces.cc:337
#2  0x0000000000c40803 in ProfileInfoCommand (theEnv=0x7f85e6454f70) at /mnt/home/worker/project/ae-arbiter/src/clips/proflfun.cc:245
#3  0x0000000000b62d12 in arbiter::lib::ClipsModuleExecute (clips=0x7f85e6454f70, features=..., max_iters=100000, result_func=..., module_name=..., halt=@0x7f879c3f6fdc)
    at /mnt/home/worker/project/ae-arbiter/src/lib/clips-utils.cc:357
...
...

調用 EnvRun 時,將 PROFILING_FUNCTIONS 設置為 1 不會自動分析代碼。 它確定分析函數是否包含在 CLIPS 可執行文件中。 請參閱高級編程指南的第 2.2 節。 可從 CLIPS 命令進行分析的函數記錄在基本編程指南的第 13.15 節,分析命令中。 ProfileInfoCommand 不能直接調用。 如果要調用不屬於高級編程指南中描述的 API 的 CLIPS 命令/函數,請使用 EnvEval API:

DATA_OBJECT returnValue;

EnvEval(theEnv,"(profile-info)",&returnValue);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM