gdb:如何在循环执行期间暂停? [英] gdb: How do I pause during loop execution?

查看:321
本文介绍了gdb:如何在循环执行期间暂停?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7中的mingw32下使用NetBeans 7作为我的IDE在g ++中编写一个软件渲染器。



我一直需要配置它,这个需要已经达到临界质量,现在我已经放下了结构。我环顾四周,对我这个回答显示了在同时跨平台和保持简单方面最有希望。



这种方法的要点是可能是最基本的方式,最准确的)配置文件/优化方式是直接对堆栈直接采样,暂停执行...不幸的是,NetBeans 不会暂停。所以我试图找出如何做这个抽样与gdb直接。



我不知道一个关于gdb的很多。我可以从man页面告诉,是你在之前设置断点运行您的可执行文件。这不会帮助我。



有人知道一个简单的方法来获取gdb(或其他gnu工具):


  1. (最好)采样堆栈

  2. 随机抽取一堆样本

    >解决方案

    你试过简单地在gdb中运行你的可执行文件,然后当你想要中断它时,只要点击^ C( Ctrl + C 这会让你到gdb的提示符,你可以简单地运行其中命令查看你在哪里,然后继续执行 continue


    I'm writing a software renderer in g++ under mingw32 in Windows 7, using NetBeans 7 as my IDE.

    I've been needing to profile it of late, and this need has reached critical mass now that I'm past laying down the structure. I looked around, and to me this answer shows the most promise in being simultaneously cross-platform and keeping things simple.

    The gist of that approach is that possibly the most basic (and in many ways, the most accurate) way to profile/optimise is to simply sample the stack directly every now and then by halting execution... Unfortunately, NetBeans won't pause. So I'm trying to find out how to do this sampling with gdb directly.

    I don't know a great deal about gdb. What I can tell from the man pages though, is that you set breakpoints before running your executable. That doesn't help me.

    Does anyone know of a simple approach to getting gdb (or other gnu tools) to either:

    1. Sample the stack when I say so (preferable)
    2. Take a whole bunch of samples at random intervals over a given period

    ...give my stated configuration?

    解决方案

    Have you tried simply running your executable in gdb, and then just hitting ^C (Ctrl+C) when you want to interrupt it? That should drop you to gdb's prompt, where you can simply run the where command to see where you are, and then carry on execution with continue.

    这篇关于gdb:如何在循环执行期间暂停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆