* Setting breakpoints in a virtual function on a dynamically loaded DLL
@ 2002-03-31 16:53 Koon-Seng Lim
2002-03-31 17:07 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Koon-Seng Lim @ 2002-03-31 16:53 UTC (permalink / raw)
To: gdb
Hi,
I'm trying to set a breakpoint in a virtual function (new_foo::bar())
implemented in a DLL (testdll.dll) which I load dynamically from an .exe
(fooloader.exe). I get the following errors:
$ gdb fooloader.exe
...
(gdb) shared testdll.dll
(gdb)
(gdb) break new_foo::bar
Error: Cannot access memory at address 0x010001014
If I forcibly set a breakpoint at new_foo::bar using the GUI, I get an
error dialog that says "cannot insert breakpoint 1:" and the message
"Error: Cannot access memory at address 0x01000101e" in the console
window.
My question is:
1. Is there any way at all to set a breakpoint in the testdll.dll?
2. Did I doing something silly? The code is very simple and it steps
correctly under the MSVC debugger.
I'm running gdb 5.0 with the Insight GUI on cygwin 1.3.10 on a windows
box. Any help is greatly appreciated!!!
The 3 files listed below are compiled and linked using:
c++ -g -DVERBOSE -DWIN32 -DDLL_EXPORT -I. -c -o fooloader.o
fooloader.cpp
c++ -g -DVERBOSE -DWIN32 -DDLL_EXPORT -I. -c -o testdll.o testdll.cpp
c++ -shared -o testdll.dll -mwindows --export-all testdll.o
/lib/libstdc++.a
c++ -o fooloader.exe fooloader.o
--------------------------foo.h -------------------------
class foo {
public:
virtual void bar() = 0;
};
-----------------------testdll.cpp-----------------------
#include <stdio.h>
#include "foo.h"
#ifdef __cplusplus
extern "C" {
#endif
void *create_object();
#ifdef __cplusplus
}
#endif
class new_foo : foo {
public:
void bar();
};
void new_foo::bar() {
printf("in new_foo::bar()\n");
}
void *create_object() {
return (void *)new new_foo;
}
-----------------------fooloader.cpp------------------------
#include <windows.h>
#include "foo.h"
typedef void *(*CREATE_OBJECT)();
int main() {
HMODULE module = LoadLibrary("testdll.dll");
CREATE_OBJECT create_foo = (CREATE_OBJECT)GetProcAddress(module,
"create_object");
foo *my_foo = (foo *)(create_foo)();
my_foo->bar();
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Setting breakpoints in a virtual function on a dynamically loaded DLL
2002-03-31 16:53 Setting breakpoints in a virtual function on a dynamically loaded DLL Koon-Seng Lim
@ 2002-03-31 17:07 ` Daniel Jacobowitz
2002-03-31 18:22 ` Koon-Seng Lim
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2002-03-31 17:07 UTC (permalink / raw)
To: Koon-Seng Lim; +Cc: gdb
On Sun, Mar 31, 2002 at 07:52:31PM -0500, Koon-Seng Lim wrote:
> Hi,
>
> I'm trying to set a breakpoint in a virtual function (new_foo::bar())
> implemented in a DLL (testdll.dll) which I load dynamically from an .exe
> (fooloader.exe). I get the following errors:
>
> $ gdb fooloader.exe
> ...
> (gdb) shared testdll.dll
> (gdb)
> (gdb) break new_foo::bar
> Error: Cannot access memory at address 0x010001014
>
> If I forcibly set a breakpoint at new_foo::bar using the GUI, I get an
> error dialog that says "cannot insert breakpoint 1:" and the message
> "Error: Cannot access memory at address 0x01000101e" in the console
> window.
>
> My question is:
> 1. Is there any way at all to set a breakpoint in the testdll.dll?
> 2. Did I doing something silly? The code is very simple and it steps
> correctly under the MSVC debugger.
>
> I'm running gdb 5.0 with the Insight GUI on cygwin 1.3.10 on a windows
> box. Any help is greatly appreciated!!!
- What version of GCC are you using?
- Please try a GDB snapshot; 5.0 is very old now, and has rotten C++
support.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Setting breakpoints in a virtual function on a dynamically loaded DLL
2002-03-31 17:07 ` Daniel Jacobowitz
@ 2002-03-31 18:22 ` Koon-Seng Lim
0 siblings, 0 replies; 3+ messages in thread
From: Koon-Seng Lim @ 2002-03-31 18:22 UTC (permalink / raw)
To: 'Daniel Jacobowitz'; +Cc: gdb
> -----Original Message-----
> From: Daniel Jacobowitz [mailto:drow@mvista.com]
> Sent: Sunday, March 31, 2002 8:08 PM
> To: Koon-Seng Lim
> Cc: gdb@sources.redhat.com
> Subject: Re: Setting breakpoints in a virtual function on a
dynamically
> loaded DLL
>
> On Sun, Mar 31, 2002 at 07:52:31PM -0500, Koon-Seng Lim wrote:
> > Hi,
> >
> > I'm trying to set a breakpoint in a virtual function
(new_foo::bar())
> > implemented in a DLL (testdll.dll) which I load dynamically from an
.exe
> > (fooloader.exe). I get the following errors:
> >
> > $ gdb fooloader.exe
> > ...
> > (gdb) shared testdll.dll
> > (gdb)
> > (gdb) break new_foo::bar
> > Error: Cannot access memory at address 0x010001014
> >
> > If I forcibly set a breakpoint at new_foo::bar using the GUI, I get
an
> > error dialog that says "cannot insert breakpoint 1:" and the message
> > "Error: Cannot access memory at address 0x01000101e" in the console
> > window.
> >
> > My question is:
> > 1. Is there any way at all to set a breakpoint in the testdll.dll?
> > 2. Did I doing something silly? The code is very simple and it steps
> > correctly under the MSVC debugger.
> >
> > I'm running gdb 5.0 with the Insight GUI on cygwin 1.3.10 on a
windows
> > box. Any help is greatly appreciated!!!
>
> - What version of GCC are you using?
> - Please try a GDB snapshot; 5.0 is very old now, and has rotten C++
> support.
>
> --
> Daniel Jacobowitz Carnegie Mellon University
> MontaVista Software Debian GNU/Linux Developer
Thanks for the reply!
I'm using gcc version 2.95.3-5. I've just tried out the latest weekly
snapshot(insight+dejagnu-weekly-20020326.tar.bz2) but alas, he problem
remains.
Thanks
-Koon Seng
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-01 2:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-31 16:53 Setting breakpoints in a virtual function on a dynamically loaded DLL Koon-Seng Lim
2002-03-31 17:07 ` Daniel Jacobowitz
2002-03-31 18:22 ` Koon-Seng Lim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox