From: Sergio Durigan Junior <sergiodj@redhat.com>
To: "Dave.Tian" <xhengdf@gmail.com>
Cc: tromey@redhat.com, gdb-patches@sourceware.org
Subject: Re: [PATCH] bug fix for gdb 16039
Date: Mon, 28 Oct 2013 23:33:00 -0000 [thread overview]
Message-ID: <m3hac1ynrj.fsf@redhat.com> (raw)
In-Reply-To: <CAKjgB1NDEZX3hDFY6pFzH397nMtNOkwtKVm-msR_5D5eZSGWyQ@mail.gmail.com> (Dave Tian's message of "Mon, 21 Oct 2013 12:29:02 +0800")
On Monday, October 21 2013, Dave Tian wrote:
> Testcase below:
>
> ----Makefile----
> so:
> g++ -shared -static-libstdc++ -static-libgcc -fPIC -rdynamic
> dy.cxx -m32 -o libdy.so
> all: so
> g++ -m32 -ldl main.cxx -g -o main
>
> ----dy.cxx----
> #include <string>
> using namespace std;
>
> extern "C" const char * getVerson()
> {
> std::string verson = "1.0";
> return verson.c_str();
> }
>
> ----main.cxx----
> #include <dlfcn.h>
> #include <stdio.h>
> #include <string>
> #include <iostream>
> using namespace std;
>
> int main()
> {
> void *handle = dlopen("libdy.so", RTLD_LAZY);
> if (!handle) {
> fprintf (stderr, "%s\n", dlerror());
> return 1;
> }
>
> typedef const char*(*FUNCTION)();
> FUNCTION f = (FUNCTION)dlsym(handle, "getVerson");
> std::cout << f();
>
> dlclose(handle);
>
> // 'next' cmd stop work here
> int a, b, c;
> a = 1;
> b = 2;
> c = 3;
> std::cout << a << b << c;
> }
Sorry for taking so long to respond.
Thanks, but this testcase should actually be made in the default
fashion, i.e., take a look at the directory gdb/testsuite and see the
many directories and testcases there.
You will also find this link useful:
<https://sourceware.org/gdb/wiki/GDBTestcaseCookbook>
Thanks for persevering.
--
Sergio
prev parent reply other threads:[~2013-10-28 23:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 2:18 Dave.Tian
2013-10-16 3:31 ` Sergio Durigan Junior
2013-10-16 6:44 ` Dave.Tian
2013-10-17 20:25 ` Tom Tromey
2013-10-19 4:38 ` Sergio Durigan Junior
2013-10-21 4:29 ` Dave.Tian
2013-10-28 23:33 ` Sergio Durigan Junior [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3hac1ynrj.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
--cc=xhengdf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox