0

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?

MDuh
  • 415
  • 1
  • 7
  • 19

1 Answers1

2

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?
Community
  • 1
  • 1
OlivierLi
  • 2,798
  • 1
  • 23
  • 30
  • Looks like I cannot do these I guess. I just tried the gdbinit method and looks like the machine is protected on where I'm working at. It spits error "auto-loading has been declined by your `auto-load safe-path". Thanks for the help anyways – MDuh Feb 19 '14 at 23:05