From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32445 invoked by alias); 28 Oct 2013 23:33:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32432 invoked by uid 89); 28 Oct 2013 23:33:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Oct 2013 23:33:15 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9SNXDKo027267 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 Oct 2013 19:33:13 -0400 Received: from psique (ovpn-113-78.phx2.redhat.com [10.3.113.78]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9SNX6HB024660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 28 Oct 2013 19:33:10 -0400 From: Sergio Durigan Junior To: "Dave.Tian" Cc: tromey@redhat.com, gdb-patches@sourceware.org Subject: Re: [PATCH] bug fix for gdb 16039 References: X-URL: http://www.redhat.com Date: Mon, 28 Oct 2013 23:33:00 -0000 In-Reply-To: (Dave Tian's message of "Mon, 21 Oct 2013 12:29:02 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00887.txt.bz2 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 > using namespace std; > > extern "C" const char * getVerson() > { > std::string verson = "1.0"; > return verson.c_str(); > } > > ----main.cxx---- > #include > #include > #include > #include > 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: Thanks for persevering. -- Sergio