debugging

Detecting debugger on Mac OS X

坚强是说给别人听的谎言 提交于 2021-02-06 13:41:24
问题 I am trying to detect whether my process is being run in a debugger or not and, while in Windows there are many solutions and in Linux I use: ptrace(PTRACE_ME,0,0,0) and check its return value, I did not manage to perform the same basic check on Mac OS X. I tried to use the ptrace(PT_TRACE_ME,0,0,0) call but it always returns 0 even when run under gdb. If I change the request to PT_DENY_ATTACH it correctly stops the debugging but that is not what I want to achieve. Any ideas? 回答1: You can

Detecting debugger on Mac OS X

我的未来我决定 提交于 2021-02-06 13:41:16
问题 I am trying to detect whether my process is being run in a debugger or not and, while in Windows there are many solutions and in Linux I use: ptrace(PTRACE_ME,0,0,0) and check its return value, I did not manage to perform the same basic check on Mac OS X. I tried to use the ptrace(PT_TRACE_ME,0,0,0) call but it always returns 0 even when run under gdb. If I change the request to PT_DENY_ATTACH it correctly stops the debugging but that is not what I want to achieve. Any ideas? 回答1: You can

How to get a stack trace when C++ program crashes? (using msvc8/2005)

两盒软妹~` 提交于 2021-02-06 11:55:50
问题 Sometimes my c++ program crashes in debug mode, and what I got is a message box saying that an assertion failed in some of the internal memory management routines (accessing unallocated memory etc.). But I don't know where that was called from, because I didn't get any stack trace. How do I get a stack trace or at least see where it fails in my code (instead of library/ built-in routines)? 回答1: If you have a crash, you can get information about where the crash happened whether you have a

How to get a stack trace when C++ program crashes? (using msvc8/2005)

别来无恙 提交于 2021-02-06 11:55:11
问题 Sometimes my c++ program crashes in debug mode, and what I got is a message box saying that an assertion failed in some of the internal memory management routines (accessing unallocated memory etc.). But I don't know where that was called from, because I didn't get any stack trace. How do I get a stack trace or at least see where it fails in my code (instead of library/ built-in routines)? 回答1: If you have a crash, you can get information about where the crash happened whether you have a

Debugging in Code::Blocks doesn't seem to work - missing debugging symbols

与世无争的帅哥 提交于 2021-02-06 11:08:42
问题 I'm trying to debug a program in Code::Blocks. I followed this guide and this short video as far as I could, but the debugger doesn't stop at breakpoints ... I saw a similar question which remained unsolved (I wasn't sure if I should bump it or open a new one with more details), I do have the "Produce debugging symbols [-g]" flag checked. Optimizations and "Strip all symbols [-s]" are also all disabled. I even tried the flag -ggdb as suggested there, no success either. I'm using TDM-GCC 4.5.2

Debugging in Code::Blocks doesn't seem to work - missing debugging symbols

戏子无情 提交于 2021-02-06 11:04:35
问题 I'm trying to debug a program in Code::Blocks. I followed this guide and this short video as far as I could, but the debugger doesn't stop at breakpoints ... I saw a similar question which remained unsolved (I wasn't sure if I should bump it or open a new one with more details), I do have the "Produce debugging symbols [-g]" flag checked. Optimizations and "Strip all symbols [-s]" are also all disabled. I even tried the flag -ggdb as suggested there, no success either. I'm using TDM-GCC 4.5.2

wait for gdb to attach [duplicate]

て烟熏妆下的殇ゞ 提交于 2021-02-06 10:15:27
问题 This question already has answers here : Is there any way to tell gdb to wait for a process to start and attach to it? (6 answers) Closed 2 years ago . I've been using gdb normally for 1 or 2 projects. I.e. I invoke gdb --args prog args . gdb runs in the same tty as the program I'm debugging. However my latest project is modifying the dtach utility. This is a program like screen, so the tty's are redirected elsewhere, thus I have to use gdb's attach functionality. The problem with gdb attach

wait for gdb to attach [duplicate]

浪尽此生 提交于 2021-02-06 10:15:05
问题 This question already has answers here : Is there any way to tell gdb to wait for a process to start and attach to it? (6 answers) Closed 2 years ago . I've been using gdb normally for 1 or 2 projects. I.e. I invoke gdb --args prog args . gdb runs in the same tty as the program I'm debugging. However my latest project is modifying the dtach utility. This is a program like screen, so the tty's are redirected elsewhere, thus I have to use gdb's attach functionality. The problem with gdb attach

How can I debug at design time?

强颜欢笑 提交于 2021-02-06 10:01:10
问题 I created a custom ListView with a UserControl. When the mouse enters the ColumnHeader it should change color at design time. It works, but I need to debug code. How can I debug code at design time? 回答1: See Walkthrough: Debugging Custom Windows Forms Controls at Design Time (MSDN). Or in a shorter way to do it just once: Start Visual Studio twice with the same solution. The first with an opened designer of your control, the second to attach by using menu Tools → Attach to Process → the other

How to analyse a crash dump file using GDB

ε祈祈猫儿з 提交于 2021-02-06 09:16:32
问题 I have a server application running under Cent OS. The server answers many requests per second but it repeatedly crashes after each hour or so and creates a crash dump file. The situation is really bad and I need to find out the crash cause as soon as possible. I suspect that the problem is a concurrency problem but I'm not sure. I have access to the source code and crash dump files but I don't know how to use the crash dumps to pin point the problem. Any suggestions are much appreciated. 回答1