The CPP program crash before the breakpoint. Why?

topic description

A CPP program that breaks the first line of the main function when debugging. After run, it will crash before it reaches the breakpoint.
what is the possible cause of this problem?

sources of topics and their own ideas

this is a question I encountered when I interviewed Jinri Toutiao Shanghai. I had no idea at all.

the boss taught me

CPP
Jul.07,2022

since there is no run in the first line of main , I wonder if there was an error before the first line? For example, in the following code, if you break the cout breakpoint on the first line of main , you will crash before the breakpoint, because the constructor of the global variable is executed before the mian function. I thought about it briefly, and this is also a reason. There should be some other reasons. Let's see what other great gods say.

main CPP

__attribute__((constructor)) void doBeforeMain(){
    printf(" : %s \n",__func__);
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ed4f72-48256.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ed4f72-48256.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?