MDuh
MDuh

Reputation: 425

I want to demo my program using gdb and a makefile script, but make won't execute further commands after gdb

Here is my makefile code

all: ass3

ass3: ass3.asm
    nasm -f elf ass3.asm
    ld -m elf_i386 -s ass3.o -o demo
    echo Start debugging\n
    gdb demo
    echo Breakpoint after first case has been calculated\n
    b *0x804809e
    echo Printing 1st case answer\n
    i ecx
    echo Breakpoint after second case has been calculated\n
    b *0x80480ba
    i ecx
    echo Breakpoint on third case showing the execution path when the difference of time    is negative\n
    b *0x8048113
    echo Since Initial time is large than final time, it will jump to an error catcher\n
    r
    echo Program caught the error and terminated the program\n

binaries = demo

clean: 
    rm -f $(binaries) *~

When I type make, it stops on gdb and when I press "q" (which is quit), It just proceeds executing the echo until it stops on b *0x804809e which is a gdb command

How do I make my makefile code do a demo run on gdb?

Upvotes: 0

Views: 279

Answers (1)

OlivierLi
OlivierLi

Reputation: 2846

gdb starts its own prompt so you can't interact with it directly.

It reads .gdbinit on launch after starting so you can modify that to automate it.

Edit :

These questions might help you :

  1. What are the best ways to automate a GDB debugging session?
  2. Where is .gdbinit is located and how can I edit it?

Upvotes: 2

Related Questions