GDB在尝试显示精美打印的std::vector时崩溃。

huangapple go评论73阅读模式
英文:

GDB crashes trying to display pretty-printed std::vector

问题

如何在逐步进入函数并进行GDB漂亮打印时避免GDB崩溃或挂起,例如STL向量,该向量未被跨越以进行初始化。

例如,漂亮地打印未在函数中初始化的向量可能显示数百万个元素,但由于向量内部的未初始化值,尚未越过。当我越过该行时,向量保持0个元素。

有没有办法避免这种情况?

英文:

how to avoid GDB crashing or hanging when entering a function step by step and GDB pretty printing for example STL vector which has not been stepped over to be initialized.

For example pretty printing a vector that is not initialized in function can show over millions of elements, but that due to uninitialized value inside a vector, which hasn't been stepped over. Immediately when i step over line the vector holds 0 elements.

Any way to avoid this?

答案1

得分: 0

The best way to avoid this is by not displaying contents of a vector until it has been initialized.

If you are doing it via display GDB command, don't.

If this is happening because your GUI does it, don't use that GUI.

英文:

> Any way to avoid this?

The best way to avoid this is by not displaying contents of a vector until it has been initialized.

If you are doing it via display GDB command, don't.

If this is happening because your GUI does it, don't use that GUI.

huangapple
  • 本文由 发表于 2023年3月7日 00:38:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75653472.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定