0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Merge branch 'master' of git@github.com:mongodb/mongo

This commit is contained in:
Eliot Horowitz 2009-11-03 14:45:14 -05:00
commit 03d189f518

View File

@ -959,22 +959,27 @@ namespace mongo {
/* Magic gdb trampoline
* Assumptions:
* 1) gdbserver is on your path
* 2) gdbserver will take <1s to start and attach
* 2) You have run "handle SIGSTOP noprint" in gdb
* 3) cmdLine.port + 2000 is free
*/
void launchGDB(int){
// Don't come back here
signal(SIGTRAP, SIG_IGN);
int newPort = cmdLine.port + 2000;
string newPortStr = "localhost:" + BSONObjBuilder::numStr(newPort);
string pidToDebug = BSONObjBuilder::numStr(getpid());
cout << "\n\n\t**** Launching gdbserver on " << newPortStr << " for pid " << pidToDebug << " ****\n\n";
cout << "\n\n\t**** Launching gdbserver on " << newPortStr << " ****" << endl << endl;
if (fork() == 0){
//child
execlp("gdbserver", "gdbserver", "--attach", newPortStr.c_str(), pidToDebug.c_str(), NULL);
perror(NULL);
}else{
//parent
raise(SIGSTOP); // pause all threads until gdb connects and continues
raise(SIGTRAP); // break inside gdbserver
}
//parent
sleep(1);
}
void setupSignals() {