Omnet++> Caused a Debugging error - gdb

I was debugging on Omnet++ program and I was trying to find the value of a constant so I went around with the options in the debugger.
Then when I wanted to debug again I got this error
Error in final launch sequence Failed to execute MI command:
-exec-run Error message from debugger back end:
Warning:\nCannot insert breakpoint 1.\nCannot access memory at address 0x0\n
Warning:\nCannot insert breakpoint 1.\nCannot access memory at address
0x0\n
The program runs fine but not with debugging
I searched online and found that this error has to do with GDB
accessing memory at address 0x0 means that I am trying to dereference a null pointer.
Also this error is shown in the debug tab of omnet++
terminated, exit value: 0 gdb (7.11.1)
Any one have an idea what might be the problem. Should I remove the Omnet++ and download it again?

I don't know why but I found this line in the breakpoints tab as shown in the picture, solved by removing it.

Related

Process returned -1073741819 (0xC0000005) execution time : 2.049 s

This one is really frustrating, I have no idea where it is coming from.
A little backstory
I am working on my chess game in c++, and currently I'm on the chess engine part. Everything is going on well, suddenly, at this very specific position of pieces on the board, this error comes
Process returned -1073741819 (0xC0000005) execution time : 2.049 s
Press any key to continue.
It comes during the calculation on the moves, it just stops in the middle and shows this error. The project itself isn't small. I haven't been able to narrow this error down to any of the functions, it just happens. I have read a lot about it and I have seen it being related to pointers?, I am not using them in my program, What can I do to start solving this issue?
I don't really know where the error comes from so I have no idea what code I can provide here.
I am using The Code::Blocks IDE with mingw compiler
If you're on linux and have command line executable, you can follow below steps
Run your executable inside gdb ( gdb ./your_executable )
Start running your executable by run command
This will crash your program inside gdb env.
Now enter where command to know full back trace of crash
You can also apply break point to that function ( break "fun_name" ) after knowing the location of crash and monitor its stack contents by entering bt full

How to enable leaks in gdb which is debugging a running process?

I am using GDB to debug a running process using #gdb -p . Now I would like to set some break points and want to get leaks information. But I'm getting an error as below.
(gdb) info leaks
Leak detection is not enabled now.
If I try to set heap flags on, I'm getting error as mentioned below.
(gdb) set heap-check leaks on
librtc is not loaded: Either use -leaks command line option, set heap-check before starting the program, or link librtc explicitly
Hence please help me in a way to enable Leaks information.
Seems like you are on HP-UNIX,
If so try to use HP Wildebeest debugger.
There is a good documentation:
http://h20565.www2.hpe.com/hpsc/doc/public/display?sp4ts.oid=5060273&docId=emr_na-c02725289&docLocale=en_US
Refer PAGE number 8.
If you want very specific answer to your question:
Enable memleak option in gdb for linux

XCode 4.6 - Debugging EXC_BAD_ACCESS without a stack trace

I already searched the web for a while but it appears my problem is very rare:
I'm programming a Audio Unit Plugin with JUCE in C++.
When I run it in a host, the host crashes. When I attach the XCode debugger to the hoist before loading my plugin, it points me to the following:
error: address doesn't contain a section that points to a section in a object file
If I type "bt" into the debug console, it says:
* thread #1: tid = 0x1f03, 0x00000000, stop reason = EXC_BAD_ACCESS (code=2, address=0x0)
frame #0: 0x00000000
I don't get a stack trace, making it impossible to find the source of the bug. It would help a lot to see, what was executed right before the bad access happened, but I can't figure out how.
I can set a breakpoint somewhere in the program and from there slowly make my way through the code until I reach the crash. I did this and eventually the execution leaves my source code and I get the assembly lines. I can see it jumping out of a lot of calls with the "ret" command. Eventually on one "ret" command, the crash occurs.
The assembly code is from the host that runs my plugin. But the crash appears on different types of host so I'm pretty sure, its a fault on my side. Any ideas?
Thank you!

User Breakpoint Called From Code At 0X7c90120120e

I'm debugging a code in VS that I wrote in C.
For some reason, at some point it jumps to an assembly window with the following line:
int 3
And a pop up message box appears with the following message:
User Breakpoint Called From Code At 0X7c90120120e
I looked at the stack, and the command that caused that was MALLOC !
In output window:
Heap missing last entry in committed range near 22549c0
The weird thing is, when I press OK at the message then F5 to continue debugging it continues and everything works 100%. But when I try to execute the code I get a message that my project encountered some problem.
I tried cleaning my project, rebuilding, removing all breakpoints .. nothing worked.
First of all thank you all for commenting/ answering.
I solved the problem. I found out that I was trying to Free the same memory TWICE.
The reason that I didn't notice it before is that the "Free" (delete function) wasn't in the same function nor the same file as where the debugger stopped/ the breakpoint occured(on malloc).
So if anyone is having the same problem, just make sure you are not Free-ing the same memory more than once.
Possible duplicate of this stack overflow thread.And here's an explanation of this problem in this link.Hope that helps you out.

How to trace from where i am getting ct_cmd_alloc error thrown in my application

I have an application Where I am running a process. while this process runs I get a
ct_cmd_alloc error saying malloc failed . I understand that this error is thrown when
the allocation of memory space fails . But I want to know if there is any other reason
Where i should concenterate to find this error .
My most important concern is How can i actually pin point where and what in my code
is resulting into this error. can i use gdb ,mdb or say d-Trace to pin pointy the location
and if so How can i proceed for that.
If you run your program in gdb and cause the exception to happen, you can type the command where to get a stack trace.
Make sure to compile your program with debug flags enabled (-g)
In gdb you can put a catchpoint on the throw command. This will interrupt anytime an exception is thrown:
(gdb) catch throw