This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to store function-name and its return values while program runs

On Fri, Nov 21, 2008 at 11:04 AM, Michael Snyder <> wrote:

> (gdb) break function1
> (gdb) commands
>> finish
>> continue
>> end
> (gdb)

I wished many times that above worked, but it doesn't: 'finish'
appears to interrupt flow of script, and subsequent commands are
never executed:

  cat t.c
  int foo() { return 42; }
  int main() { return foo(); }

  gcc -g t.c

  gdb64-cvs ./a.out
  GNU gdb (GDB)
  Copyright (C) 2008 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  and "show warranty" for details.
  This GDB was configured as "x86_64-unknown-linux-gnu".
  For bug reporting instructions, please see:
  (gdb) b foo
  Breakpoint 1 at 0x400310: file t.c, line 1.
  (gdb) commands 1
  >print/a $pc
  (gdb) r

  Breakpoint 1, foo () at t.c:1
  1       int foo() { return 42; }
  0x0000000000400325 in main () at t.c:2
  2       int main() { return foo(); }
  Value returned is $1 = 42

# Neither 'print/a $pc' nor 'continue' executed :(

  (gdb) q

Is this a bug?

Paul Pluzhnikov

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]