This is the mail archive of the gdb@sourceware.cygnus.com 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]

Re: Call function in gdb


>>>>> "hjl" == H J Lu <hjl@lucon.org> writes:
hjl> Hi, With old gdb, I can do
hjl>
hjl> (gdb) call foo (1)
hjl>
hjl> Now with gdb in CVS, I got "segmentation fault". Any ideas, BTW,
hjl> I am using Linux/i386.

You don't offer much to go on.  For what it's worth, calling inferior
functions with a freshly built-from-the-last-snapshot NetBSD/i386 gdb
with the following test code:

  int
  foo(int x)
  {
          return x + 1;
  }

  main()
  {
          exit (0);
  }

appears to work fine.

  ./gdb -nx a.out
  GNU gdb 19991108
  Copyright 1998 Free Software Foundation, Inc.
  GDB is free software, covered by the GNU General Public License, and you are
  welcome to change it and/or distribute copies of it under certain conditions.
  Type "show copying" to see the conditions.
  There is absolutely no warranty for GDB.  Type "show warranty" for details.
  This GDB was configured as "i386-unknown-netbsd1.3E"...
  (gdb) break main
  Breakpoint 1 at 0x1804: file foo.c, line 10.
  (gdb) run
  Starting program: /sandbox/gdb/gdb-sync3/=i386-netbsd/gdb/a.out 

  Breakpoint 1, main () at foo.c:10
  10              exit (0);
  (gdb) call foo(1)
  $1 = 2


-- 
J.T. Conklin
RedBack Networks

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