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

[Bug c++/13225] New: GDB fails to find non-overloaded C++ function


http://sourceware.org/bugzilla/show_bug.cgi?id=13225

             Bug #: 13225
           Summary: GDB fails to find non-overloaded C++ function
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jimb@red-bean.com
    Classification: Unclassified


When I try to call JS_CompileFunction in the following test program, GDB says:

Cannot resolve function JS_CompileFunction to any overloaded instance

However, if I cast one of the zeros to "const char **", GDB can find the
function.

$ cat archer-bug.cpp
#include <stdlib.h>

typedef unsigned uintN;

struct JSContext;
struct JSFunction;
struct JSObject;

JSFunction *
JS_CompileFunction(JSContext *cx, JSObject *obj, const char *name,
                   uintN nargs, const char **argnames,
                   const char *bytes, size_t length,
                   const char *filename, uintN lineno) { }


int main(int argc, char **argv) {
  JSContext *cx = NULL;
  JSObject *global = NULL;
  JS_CompileFunction(cx, global, "f", 0, 0, "1", 1, "foo.js", 1);
  return 0;
}
$ g++ -g archer-bug.cpp -o archer-bug$ ~/gdb/bin/gdb archer-bug
GNU gdb (GDB) 7.3.50.20110925-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jimb/play/archer-bug...done.
(gdb) start
Temporary breakpoint 1 at 0x4005a1: file archer-bug.cpp, line 17.
Starting program: /home/jimb/play/archer-bug 

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe738) at archer-bug.cpp:17
17      JSContext *cx = NULL;
(gdb) next
18      JSObject *global = NULL;
(gdb) 
19      JS_CompileFunction(cx, global, "f", 0, 0, "1", 1, "foo.js", 1);
(gdb) 
20      return 0;
(gdb) p JS_CompileFunction(cx, global, "f", 0, 0, "1", 1, "foo.js", 1)
Cannot resolve function JS_CompileFunction to any overloaded instance
(gdb) p JS_CompileFunction(cx, global, "f", 0, (const char **) 0, "1", 1,
"foo.js", 1)
$1 = NULL
(gdb)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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