当执行在并行区域中停止时,where 命令会显示包含外联子例程的堆栈跟踪。
(dbx) where current thread: t@4 =>[1] _$d1E48.main(), line 52 in "test.c" [2] _$p1I46.main(), line 48 in "test.c" --- frames from parent thread --- current thread: t@1 [7] main(argc = 1, argv = 0xffffffff7fffec98), line 46 in "test.c"
堆栈的顶帧是外联函数帧。尽管代码是外联的,源代码行号仍映射回 15。
当执行在并行区域中停止时,如果相关帧仍处于活动状态,来自从属线程的 where 命令将输出主线程的堆栈跟踪。来自主线程的 where 命令具有完全的回溯。
也可以首先使用 omp_team 命令列出当前组中的所有线程,然后切换到主线程(OpenMP 线程 ID 为 0 的线程)并从该线程获得堆栈跟踪,以此来确定执行到达从属线程中断点的方式。