Need to put a breakpoint in gdb using bash shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to put a breakpoint in gdb using bash shell
# 1  
Old 04-15-2009
Java Need to put a breakpoint in gdb using bash shell

I want a way to put a break point in gdb by runing a shell script.


Actualy I wanted to do certain automisation of a long manual process, which includes starting of a process in background and then taking the process ID of that process and then attach the gdb to that process ID. Then finaly put a break point at a specific location.


Is there any way to do it?
# 2  
Old 04-15-2009
Why don't you just start the program from within gdb? That way you could set up all the breakpoints you need before the program even starts running.
# 3  
Old 04-15-2009
I need to automate the process.

So that just run the script. Don't had to start the gdb and then put a breakpoint.
# 4  
Old 04-15-2009
Option 1: start the program from within gdb using a script you passed along using -x
Option 2: start the program in the background, start gdb using the process id ($!) and -x gdbfile, where gdbfile contains "break <line number>"

Since both options use the -x switch, I suggest taking a look at the gdb man page on what it does exactly.
# 5  
Old 04-15-2009
Thanks alot for your great help pludi
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run several bash commands put in bash command line?

How to run several bash commands put in bash command line without needing and requiring a script file. Because I'm actually a windows guy and new here so for illustration is sort of : $ bash "echo ${PATH} & echo have a nice day!" will do output, for example:... (4 Replies)
Discussion started by: abdulbadii
4 Replies

2. Shell Programming and Scripting

Put a command into router through sshpass bash script

hello, i am facing some issue. I am using a simple bash script that via sshpass put a command into router. Now, problem is that i have a file and commands into it. sshpass -p $pass ssh -o $log -n $user@$h /ip address set address=10.0.0.1/24 so if I have that command ip address set ... (0 Replies)
Discussion started by: tomislav91
0 Replies

3. UNIX for Advanced & Expert Users

GDB Breakpoint Internals

When we put a breakpoint using gcc then what all things happen internally and how the gdb using break is able to pause the execution of process( instead of killing it ) and later on resume the process execution? (0 Replies)
Discussion started by: rupeshkp728
0 Replies

4. Shell Programming and Scripting

How i can put the result of a command inside a bash variable?

#!/bin/bash #... for i in `ls -c1 /usr/share/applications` do name="cat $i | grep ^Name= | cut -d = -f2" echo $name #... done Now inside name as output is present: while i want only the result of the command. Ideally i would like obtain that information using only bash ... or... (8 Replies)
Discussion started by: alexscript
8 Replies

5. UNIX for Advanced & Expert Users

BreakPoint Command Not found error

I have Suse linux-2.6.31.5-0.1. When I try to set breakpoint in application or kernel modules it gives me command not found error. For instance when I typed the command b xyz.c:47 it gives me an error: "If 'b' is not a typo you can use command-not-found lookup the package that contains... (4 Replies)
Discussion started by: rupeshkp728
4 Replies

6. Shell Programming and Scripting

SFTP bash put/get/rm check

Hello, i'm doing something like that #!/bin/sh sftp 172.18.255.140 <<End-Of-Session >> /usr/batch/logsftp.txt user batch ascii lcd /usr/batch get olaola.txt bye End-Of-Session   if then echo MAL >> /usr/batch/logsftp.txt echo $? >> /usr/batch/logsftp.txt exit $? else echo... (16 Replies)
Discussion started by: dexposit
16 Replies

7. Shell Programming and Scripting

Bash: Advice put data in a table

Hi I get some differents output from a bash script. My goal is to sort them in a kind of table, something like: Actually the table can change and I don't care about the shape, I'm just looking if there's a well know way to put the output of a script in a table or if someone has his own best... (2 Replies)
Discussion started by: Dedalus
2 Replies

8. Shell Programming and Scripting

Calling GDB commands from Shell

Hi, I have just started off with the shell programming. I need to execute a GDB command from a shell script. I have been trying to get this working from quite sometime but not getting it quite right.I have this specific requirement that i read byte data from a file and write that data to the... (0 Replies)
Discussion started by: jsantosh
0 Replies

9. Programming

Putting breakpoint on core

Any one tried puting breakpoint while debugging a core file? I have been using a gdb for running it.. But unsuccessful to put a breakpoint before executing it. Any sugestion or tool for doing it would be welcomed.. Thanks :) (0 Replies)
Discussion started by: jyotipg
0 Replies

10. UNIX for Dummies Questions & Answers

where to put shell scripts?

This could be a really dumb question, but for a newbie trying to learn, some help would be appreciated. When you write a shell script, what extension should it have, and more importantly, where do you put it???? (7 Replies)
Discussion started by: ober5861
7 Replies
Login or Register to Ask a Question