Click here to Skip to main content
15,904,024 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: function translated to ASM Pin
Richard Andrew x6430-Jan-22 4:48
professionalRichard Andrew x6430-Jan-22 4:48 
AnswerRe: function translated to ASM Pin
k505430-Jan-22 5:11
mvek505430-Jan-22 5:11 
GeneralRe: function translated to ASM Pin
Richard Andrew x6430-Jan-22 11:29
professionalRichard Andrew x6430-Jan-22 11:29 
GeneralRe: function translated to ASM Pin
Calin Negru31-Jan-22 6:49
Calin Negru31-Jan-22 6:49 
QuestionVS2019 - missing dialog editor? Pin
charlieg23-Jan-22 11:15
charlieg23-Jan-22 11:15 
SuggestionRe: VS2019 - missing dialog editor? Pin
Graham Breach23-Jan-22 21:30
Graham Breach23-Jan-22 21:30 
GeneralRe: VS2019 - missing dialog editor? Pin
charlieg24-Jan-22 2:31
charlieg24-Jan-22 2:31 
AnswerRe: VS2019 - missing dialog editor? Pin
Victor Nijegorodov23-Jan-22 21:33
Victor Nijegorodov23-Jan-22 21:33 
GeneralRe: VS2019 - missing dialog editor? Pin
charlieg24-Jan-22 2:32
charlieg24-Jan-22 2:32 
AnswerRe: VS2019 - missing dialog editor? Pin
charlieg25-Jan-22 7:34
charlieg25-Jan-22 7:34 
QuestionMessage Closed Pin
21-Jan-22 18:09
Member 1496877121-Jan-22 18:09 
AnswerRe: More about "system" call - sort of repost Pin
k505421-Jan-22 18:38
mvek505421-Jan-22 18:38 
GeneralMessage Closed Pin
22-Jan-22 4:40
Member 1496877122-Jan-22 4:40 
GeneralRe: More about "system" call - sort of repost Pin
k505422-Jan-22 5:19
mvek505422-Jan-22 5:19 
GeneralRe: More about "system" call - sort of repost Pin
Richard MacCutchan22-Jan-22 6:28
mveRichard MacCutchan22-Jan-22 6:28 
QuestionMessage Closed Pin
21-Jan-22 6:37
Member 1496877121-Jan-22 6:37 
AnswerRe: How to read "compiier output " Pin
k505421-Jan-22 7:15
mvek505421-Jan-22 7:15 
GeneralMessage Closed Pin
21-Jan-22 8:25
Member 1496877121-Jan-22 8:25 
GeneralRe: How to read "compiier output " Pin
k505421-Jan-22 11:36
mvek505421-Jan-22 11:36 
QuestionMessage Closed Pin
20-Jan-22 14:58
Member 1496877120-Jan-22 14:58 
AnswerRe: Another long shot... Pin
k505420-Jan-22 16:40
mvek505420-Jan-22 16:40 
First, make sure you're creating a debug build. Whatever IDE you're using should have a Build or Compile config section, so take a look and make sure that's set. Your IDE should have a built in link to the debugger, so just run the program in the debugger. When the error is thrown, the debugger should stop the program and allow you to examine the state of the program. If you need to use the command line, here's an example to help you get started:
Shell
$ cat bad_alloc.cpp
 #include <iostream>

int main()
{
    size_t lim = 2;
    while(true)
    {
        int *arr = new int[lim];
        delete[] arr;
        lim *= 2;
    }
    return 0;
}
$ # That will eventually try to allocate too much memory
$ # compile with gdb, in 32 bit mode to get a quick crash
$ g++ -m32 -ggdb  bad_alloc.cpp -o bad_alloc
$ # debug the program
$ gdb bad_alloc
 #
 # GDB startup messages snipped out
 #
Reading symbols from bad_alloc...
(gdb) run
Starting program: /home/ebacon/tmp/c++/bad_alloc 
terminate called after throwing an instance of 'std::bad_array_new_length'
  what():  std::bad_array_new_length

Program received signal SIGABRT, Aborted.
0xf7fce559 in __kernel_vsyscall ()
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.32-10.fc33.i686 libgcc-10.3.1-1.fc33.i686
(gdb) # take a look at the backtrace
(gdb) bt
 #0  0xf7fce559 in __kernel_vsyscall ()
 #1  0xf7d2759a in raise () from /lib/libc.so.6
 #2  0xf7d0f3d0 in abort () from /lib/libc.so.6
 #3  0x0804c829 in __gnu_cxx::__verbose_terminate_handler() [clone .cold] ()
 #4  0x080dee78 in __cxxabiv1::__terminate(void (*)()) ()
 #5  0x080def01 in std::terminate() ()
 #6  0x0804dbb0 in __cxa_throw ()
 #7  0x0804a7ee in __cxa_throw_bad_array_new_length ()
 #8  0x0804d9f7 in main () at bad_alloc.cpp:8
(gdb) # all the frames except the last are part of the STL, 
(gdb) # so we're probably only interested in frame 8 
(gdb) frame 8
 #8  0x0804d9f7 in main () at bad_alloc.cpp:8
8               int *arr = new int[lim];
(gdb) # The 8 in the line above refers to line 8 of the source 
(gdb) # print the value of lim 
(gdb) p lim
$1 = 536870912
(gdb) quit
A debugging session is active.
        Inferior 1 [process 3076940] will be killed.
Quit anyway? (y or n) y
$
Hopefully, that's enough to get you started. If you need more, then Google is your friend.
Keep Calm and Carry On

QuestionMessage Closed Pin
18-Jan-22 11:04
Member 1496877118-Jan-22 11:04 
AnswerRe: Passing system function to QProcess - need syntax help Pin
k505418-Jan-22 11:37
mvek505418-Jan-22 11:37 
Questionwindow.chrome.webview.postmessage from child html to main c++ app (webView2) Pin
Member 1543991717-Jan-22 16:20
Member 1543991717-Jan-22 16:20 
QuestionDDX_Text embedding nulls on UpdateData(TRUE) Pin
ForNow13-Jan-22 16:50
ForNow13-Jan-22 16:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.