From: Danny Backx <danny.backx@scarlet.be>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: How to fix solib path name?
Date: Wed, 08 Jul 2009 15:45:00 -0000 [thread overview]
Message-ID: <1247067931.3870.76.camel@pavilion> (raw)
In-Reply-To: <1247067073.3870.69.camel@pavilion>
[-- Attachment #1: Type: text/plain, Size: 3354 bytes --]
On Wed, 2009-07-08 at 17:31 +0200, Danny Backx wrote:
> On Wed, 2009-07-08 at 16:07 +0100, Pedro Alves wrote:
> > Maybe we can make gdbserver smarter even on CE < 6? I think I
> > remember that if you had toolhelp.dll on the device, you'd get
> > absolute paths, but I'm not sure if that's a valid memory I have.
> >
>
> I've added one printf statement to gdbserver/server.c just after where
> it assembles the library name list.
>
> Output on the infamous C++ hello2.exe below. Two out of the three are
> absolute path names. Not sure why the other one isn't.
>
> Is it best to adapt gdbserver for this ?
If the answer to my question is yes, then it's not a hard fix. It's
attached.
2009-07-08 Danny Backx <dannybackx@users.sourceforge.net>
* server.c : Strip path from DLL names.
Result is below. (Initial spooky messages due to gdb reading the wrong
directory to find the DLL. The i386 gdb tried to read an ARM dll.)
Danny
pavilion: {109} i386-mingw32ce-gdb hello2.exe
GNU gdb 6.8
Copyright (C) 2008 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 "--host=i686-pc-linux-gnu
--target=i386-mingw32ce"...
(gdb) target remote ebox:9999
Remote debugging using ebox:9999
[New Thread 68419598]
Error while mapping shared library sections:
"/opt/mingw32ce/bin/libgcc_s_sjlj-1.dll": not in executable format: File
format not recognized.
Error while mapping shared library sections:
libstdc++-6.dll: No such file or directory.
Error while mapping shared library sections:
coredll.dll: No such file or directory.
Error while reading shared library symbols:
"/opt/mingw32ce/bin/libgcc_s_sjlj-1.dll": can't read symbols: File
format not recognized.
Symbol file not found for libstdc++-6.dll
Symbol file not found for coredll.dll
WinMainCRTStartup (hInst=0x407000e, hPrevInst=0x0, lpCmdLine=0x2a01fc70,
nCmdShow=5)
at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:35
35 {
Current language: auto; currently c
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
No /opt/mingw32ce/bin/libgcc_s_sjlj-1.dll
No libstdc++-6.dll
No coredll.dll
(gdb) set
solib-search-path /opt/x86mingw32ce/bin:/opt/x86mingw32ce/i386-mingw32ce/lib:/opt/x86mingw32ce/i386-mingw32ce/bin
Error while mapping shared library sections:
coredll.dll: No such file or directory.
Reading symbols from /opt/x86mingw32ce/bin/libgcc_s_sjlj-1.dll...done.
Loaded symbols for /opt/x86mingw32ce/bin/libgcc_s_sjlj-1.dll
Reading symbols from /opt/x86mingw32ce/i386-mingw32ce/lib/libstdc
++-6.dll...done.
Loaded symbols for /opt/x86mingw32ce/i386-mingw32ce/lib/libstdc++-6.dll
Symbol file not found for coredll.dll
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x41fc1000 0x41fcc1fc
Yes /opt/x86mingw32ce/bin/libgcc_s_sjlj-1.dll
0x41ee1000 0x41fb2974
Yes /opt/x86mingw32ce/i386-mingw32ce/lib/libstdc++-6.dll
No coredll.dll
--
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
[-- Attachment #2: x --]
[-- Type: text/x-patch, Size: 970 bytes --]
Index: server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.102
diff -u -r1.102 server.c
--- server.c 30 Jun 2009 16:35:25 -0000 1.102
+++ server.c 8 Jul 2009 15:43:37 -0000
@@ -929,14 +929,24 @@
for (dll_ptr = all_dlls.head; dll_ptr != NULL; dll_ptr = dll_ptr->next)
{
struct dll_info *dll = (struct dll_info *) dll_ptr;
- char *name;
+ char *name, *lastdir, *q;
strcpy (p, " <library name=\"");
p = p + strlen (p);
name = xml_escape_text (dll->name);
- strcpy (p, name);
+
+ /* Strip directory names */
+ lastdir = 0;
+ for (q=name; *q; q++)
+ if (*q == '\\' || *q == '/')
+ lastdir = q;
+ if (lastdir)
+ strcpy(p, lastdir+1);
+ else
+ strcpy (p, name);
free (name);
p = p + strlen (p);
+
strcpy (p, "\"><segment address=\"");
p = p + strlen (p);
sprintf (p, "0x%lx", (long) dll->base_addr);
next prev parent reply other threads:[~2009-07-08 15:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-08 14:34 Danny Backx
2009-07-08 14:45 ` Aleksandar Ristovski
2009-07-08 14:51 ` Pedro Alves
2009-07-08 15:15 ` Aleksandar Ristovski
2009-07-08 15:21 ` Pedro Alves
2009-07-08 15:38 ` Aleksandar Ristovski
2009-07-08 15:49 ` Pedro Alves
2009-07-08 15:57 ` Pedro Alves
2009-07-08 17:19 ` Aleksandar Ristovski
2009-07-08 18:24 ` Pedro Alves
2009-07-08 18:30 ` Pedro Alves
2009-07-08 14:56 ` Pedro Alves
2009-07-08 15:07 ` Pedro Alves
2009-07-08 15:31 ` Danny Backx
2009-07-08 15:45 ` Danny Backx [this message]
2009-07-08 16:19 ` Pedro Alves
2009-07-08 16:30 ` Danny Backx
2009-07-08 16:42 ` Pedro Alves
2009-07-08 15:45 ` Pedro Alves
2009-07-08 17:15 ` Pedro Alves
2009-07-08 20:46 ` Danny Backx
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=1247067931.3870.76.camel@pavilion \
--to=danny.backx@scarlet.be \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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