LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-03-2012, 04:27 AM   #1
vaibhav92
LQ Newbie
 
Registered: Feb 2012
Posts: 2

Rep: Reputation: Disabled
Question forcing a process to break into gdb


Hi,

I am coming from Windows development background , where I could force a process to break into debugger by putting the __debugbreak() (http://msdn.microsoft.com/en-us/library/f408b4et.aspx) . This halts the process and prompts the user to select one of the debuggers available on the system.

I am looking for something similar on linux. The process will not be run from GDB instead it will be spawned from a running deamon and I would like it to break at some point in code and get load a debugger from where i can do step debugging of the code.

~Thanks
 
Old 02-03-2012, 05:18 AM   #2
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Ubuntu
Posts: 1,160

Rep: Reputation: 232Reputation: 232Reputation: 232
I do not know if what you are asking is possible.

What you could do is use gdb from the command line (or script) in a manner such as the following:
Code:
gdb <app> <pid>
where <app> is the name of the executable application and <pid> is the current process ID of the application.

When debugging an application, you should do so in the area where the application was built so that gdb can reference the source code files. Alternatively, you can specify the -d option (to specify the directory location of the source files) or, and I may be wrong with this, a list of source file directories within ~/.gdbinit. You may want to read more about the latter option here.
 
Old 02-08-2012, 02:36 AM   #3
vaibhav92
LQ Newbie
 
Registered: Feb 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hi dwhitney67,

Sorry for replying so late .. got stuck in some pressing assignment

Got the point you are trying to make but would have loved if had similar functionality in linux. I have tried searching for something similar but all i have got is on the same lines as you have said (

Seems like I will have to live with this limitation.

Thanks,
vaibhav92
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(gdb) break: No source file named oper Other *NIX 1 08-15-2011 01:06 PM
[Debugging] how break points work in GDB? skaushal_lk Programming 3 03-25-2011 11:42 AM
Forcing SSH Process to continue running sploit Linux - Networking 7 04-27-2009 11:23 AM
How to programmatically break into gdb from gcc C++ source cj12345 Programming 7 09-16-2004 05:15 AM


All times are GMT -5. The time now is 04:32 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration