- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试通过 python 应用程序使用 Frama-c。这个 python 应用程序设置了一些环境变量和系统路径。在这个应用程序中,我将 Frama-c 作为 python 进程调用,如下所示:
cmd = ['/usr/local/bin/frama-c', '-wp', '-wp-print', '-wp-out', '/home/user/temp','/home/user/project/test.c']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
当从 Python 应用程序执行此代码时,出现以下错误:
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] warning: your preprocessor is not known to handle option ` -nostdinc'. If pre-processing fails because of it, please add -no-cpp-gnu-like option to Frama-C's command-line. If you do not want to see this warning again, use explicitely -cpp-gnu-like option.
[kernel] warning: your preprocessor is not known to handle option `-dD'. If pre-processing fails because of it, please add -no-cpp-gnu-like option to Frama-C's command-line. If you do not want to see this warning again, use explicitely -cpp-gnu-like option.
[kernel] Parsing 2675891095.c (with preprocessing)
[kernel] System error: /usr/bin/gcc -c -C -E -I. -dD -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2675891095.cc8bf16.i' '/home/user/project/test.c': No child processes
我发现很难调试导致错误的原因:
System error: /usr/bin/gcc -c -C -E -I. -dD -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2675891095.cc8bf16.i' '/home/user/project/test.c': No child processes
有没有一种方法可以从 Frama-c 生成更多错误日志来帮助我找出问题?
请注意此错误仅在我从我的应用程序启动进程(执行 Frama-c)时发生,如果我从 python 控制台启动它则不会。而且它只发生在 Linux 机器上 而不是在 Windows 机器上。
感谢任何帮助。谢谢!!
更新:我意识到通过使用 -kernel-debug 标志我可以获得堆栈跟踪。所以我尝试了这个选项并获得了以下信息:
Fatal error: exception Sys_error("gcc -E -C -I. -dD -D__FRAMAC__ -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2884428408.c2da79b.i' '/home/usr/project/test.c': No child processes")
Raised by primitive operation at file "src/kernel_services/ast_queries/file.ml", line 472, characters 9-32
Called from file "src/kernel_services/ast_queries/file.ml", line 517, characters 14-26
Called from file "src/kernel_services/ast_queries/file.ml", line 703, characters 46-59
Called from file "list.ml", line 84, characters 24-34
Called from file "src/kernel_services/ast_queries/file.ml", line 703, characters 17-76
Called from file "src/kernel_services/ast_queries/file.ml", line 1587, characters 24-47
Called from file "src/kernel_services/ast_queries/file.ml", line 1667, characters 4-27
Called from file "src/kernel_services/ast_data/ast.ml", line 108, characters 2-28
Called from file "src/kernel_services/ast_data/ast.ml", line 116, characters 53-71
Called from file "src/kernel_internals/runtime/boot.ml", line 29, characters 6-20
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml", line 787, characters 2-9
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml", line 817, characters 18-64
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml", line 228, characters 4-8
Re-raised at file "src/kernel_services/cmdline_parameters/cmdline.ml", line 244, characters 12-15
Called from file "src/kernel_internals/runtime/boot.ml", line 72, characters 2-127
我查看了文件 “src/kernel_services/ast_queries/file.ml”,第 472 行
,执行的代码是 Sys.command cpp_command
。
我不确定为什么在尝试执行 execute gcc 时抛出“No Child Processes”错误。
更新:我有 Ocaml 版本:4.02.3,Python 版本:2.7.8 和 Frama-C 版本:Silicon-20161101
最佳答案
我对 Frama-C 一无所知。但是,错误消息来自某人(OCaml 的?Python 的?)运行时,表明系统调用因 ECHILD
错误而失败。 system()
进行的两个系统调用是fork()
和waitpid()
。可以返回 ECHILD
的是后一个系统调用。这意味着没有要等待的子进程。一个很好的可能性是 fork()
失败了。 fork()
在系统充满进程(不太可能)或达到每个用户的进程限制时失败。您可以检查自己是否遇到了此类限制。
我想到的另一种可能性是代码的其他部分已经在使用信号处理 (SIGCHLD
) 处理子进程。所以没有子进程等待的原因是它已经在别处处理了。这很快就会变得复杂,所以我希望这不是问题所在。
关于python - OCaml Sys.command 函数抛出的 "No child processes"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42460103/
我正在编写一个 python 程序,它将所有输入都大写(替代非工作 tr '[:lowers:]' '[:upper:]')。语言环境是 ru_RU.UTF-8,我使用 PYTHONIOENCODIN
我收到错误;MVC Microsoft JScript 运行时错误:Sys.ArgumentTypeException:“Sys._Application”类型的对象无法转换为“Sys._Applic
尝试使用 IDLE 在 Python 3.7.4 版本中安装 sys 包时,出现以下错误: 输入:C:\Users\UserName\Downloads>pip install sys 输出: 采集系
我对 Python 还很陌生,所以我还在学习这门语言。我遇到的一件事是重新分配 sys.stdout 以更改打印的默认输出。所以我写了这个作为测试: import sys sys.stdout = o
我应该选择 sys.exc_info()在 sys.last_value和 friend (sys.last_type,sys.last_traceback)? 最佳答案 查看sys.last_val
我的 shell 脚本中出现奇怪的错误。使用这个: $find /sys/class/ -name temp -exec cat '{}' ';' 我得到输出 77000 find: `/sys/ke
我只想从 sys 库导入 argv 和可执行函数。 所以我使用 from 和 import 来指定这些函数,如下所示:- from sys import argv from sys import ex
我想找到调用我的程序的命令行参数,即 sys.argv,但我想在 Python 使 sys.argv 可用之前执行此操作.这是因为我在 usercustomize.py 中运行代码,该代码由 site
sys和os.sys在python中有什么区别?我见过很多项目在导入os时使用sys。当我尝试 dir(sys) 和 dir(os.sys) 时,它们的功能相同,输出也相同。 我经常看到像这样使用 s
create table T ( ID number, COL1 SYS.XMLTYPE )XMLType COLUMN COL1 STORE AS CLOB; select obj#,col
下面的 SQL 似乎可以工作,但我想知道是否有更好的方法来编写它。我正在尝试选择具有特定名称的所有 View 和表。如果找到匹配项,则应该只有一个返回值。 SELECT DISTINCT name F
在我的客户端(使用 LWJGL)中,我使用以下代码: private static long getTime() { return (Sys.getTime() * 1000) / Sys.g
我的老板让我看一些旧代码,其中所有内容都被发送到 stderr。我知道 stderr 应该有警告和错误,但他们什么时候才真正应该转到 stdout? 此程序是一项服务。它发送到 stderr 的一些消
使用 importlib,“Meta Path Finder”(通过遍历 sys.meta_path 找到)和“Path Entry Finder”(通过遍历 sys.path_hooks 找到)有什
我正在运行这个命令来安装 os_sys 包: pip3 install os_sys 但收到此错误: ERROR: os-sys has an invalid wheel, could not rea
如果我查询sys.dm_database_encryption_keys,它返回的encryption_state为3(加密),percent_complete 0。如果我查询 sys.databas
有人可以向我解释一下这些不同的环境函数具体有什么作用吗?即哪个返回什么帧?阅读文档后我完全困惑了(http://stat.ethz.ch/R-manual/R-patched/library/base
查看其他 stackoverflow 帖子后,我似乎无法解决这个重定向问题。我想做的是抑制 stdout 和 stderr,然后在捕获错误后恢复它们。抑制效果很好,但恢复它们只成功了一半。 如果我尝试
这个问题在这里已经有了答案: Understanding slicing (38 个答案) 关闭 3 个月前。 我写了这段代码: #!/usr/bin/env python import sys i
我正在创建一个名为 Qt ( Github link ) 的模块,我在其中为另一个模块起别名(例如 PyQt4),这样当我导入 Qt 我实际上正在导入 PyQt4: from Qt import Qt
我是一名优秀的程序员,十分优秀!