C ++ gdb breakpoint not hit

I completely change the post. because I work in the army of South Korea. but the South Korean army’s Internet computer forbids downloading the file. so i really download my source code. but I can not. so I am trying to debug a very simple program using gdb. but it still does not work.

my system

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty

in an IDE cloud called nitrous oxide

and g ++, gdb version

g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
GNU gdb (GDB) 7.8

I am writing very simple code: simple.cpp

#include <iostream>

int main(){
   std::cout << "Hello World!" << std::endl;
   return 0;
}

compile with "-g" and gdb execute

nitrous@ubuntu-108903:~/code$ g++ -g simple.cpp -o simple
nitrous@ubuntu-108903:~/code$ gdb simple

and set the main run line and run

Reading symbols from simple...done.
(gdb) break main
Breakpoint 1 at 0x400861: file simple.cpp, line 4.
(gdb) run
Starting program: /home/nitrous/code/simple
Hello World!
During startup program exited normally.

Even a very simple helloworld program does not work with a breakpoint. just print it. During launch, the program came out in a musical form.

+4
2

, . ?

, main. ( 1000 main.)

GDB, GDB SIGSEGV. GDB where. , main .

, main , ( ).

0

, gdb - . gdb sudo. , strace grep ptrace? - strace -f -o syscall.txt gdb ./simple.out.

0

Source: https://habr.com/ru/post/1623529/


All Articles