From: Pedro Alves <pedro_alves@portugalmail.pt>
To: Pedro Alves <pedro_alves@portugalmail.pt>
Cc: gdb@sourceware.org
Subject: Re: Win32 gdbserver dll support.
Date: Thu, 26 Apr 2007 22:27:00 -0000 [thread overview]
Message-ID: <4631274C.5080603@portugalmail.pt> (raw)
In-Reply-To: <4053daab0704260940t4e0a9593lc706794c718cc3a9@mail.gmail.com>
Pedro Alves escreveu:
> Hi guys,
>
> I'm looking into adding dll support to gdbserver, primarily
> for WinCE, but Cygwin would also benefit, of course.
>
> I realize that solib support for svr4 targets works without
> special remote protocol support, because you can get at the
> link maps by just fiddling with the inferior memory, and
> putting breakpoints in the special places on the loader.
>
> There are some targets, where that isn't possible, like
> Windows, where the dynamic loader is part of the OS, or
> targets where the link map must the read from the /proc
> file system.
>
> Current native Windows support (win32-nat.c), autoloads
> the dlls symbols immediately when a LOAD_DLL_DEBUG event
> arrives, bypassing a bit the normal solib.c interface.
> I have a patch for that, that makes win32 fetch the
> loaded dlls every time through current_sos, and making
> win32_relocate_section_address to its job.
>
> It looks like that what is needed is a way to
> somehow ask gdbserver for a virtual link map, perhaps in
> textual form, that could be parsed by gdb much like one
> parses the map on /proc/ targets. That would also fit
> nicely for those targets, except they would return a
> copy of the real link map file, whereas Win32 would return
> a file generated on the fly. Eg. If AIX got gdbserver
> support, it could call
> target_ops->fetch_inferior_file ("/proc/<pid>/map") in
> build_so_list_from_mapfile, and do the same parsing as it
> already does. The fetch_inferior_file
> target_op could have a default implementation of reading
> a local file so native debugging would work unaffected.
>
> Another alternative, would be to add
> TARGET_WAITKIND_LOADED state to the remote protocol
> (an 'L' packet perhaps), and somehow
> marshall the lm_info data with the state change notification,
> which is specific for each different target_so_ops.
> I don't like this much, since there are targets where
> you would find yourself in marshalling pointers, meaning
> that probably it would be more invasive, then needs be.
> It may be more efficient, since we wouldn't fetch the whole
> solibs list everytime, but build it on the gdb size. On the
> other hand, fetching the map in one go probably isn't
> that inefficient.
>
> Adding full support for remote opening,
> seeking, stating, etc, is certainly doable, but perhaps
> a bit out of scope for simplicity of the remote protocol?
>
I actually bit the bullet and I'm investigating/implementing
remote open/close/read/write/lseek. It seems to be enough for
now. If there are any objections, please speak up, you'll
probably save me "a couple" of hours ;)
> Adding a simple 'char* read_remote_file (const char* filename)'
> in target_ops, that reads the whole file at once would
> suffice for the problem at hands. I'm ignoring buffering
> problems on purpose, since map files tend to be small.
> I would have to add TARGET_WAITKIND_LOADED state to
> the remote protocol for dll loading/unloadind notification,
> but without passing any data to gdb,
> and then gdb would fetch the dlls list with
> current_sos + fetch_remote_file in reaction to the
> state change. infrun.c:handle_inferior_event already does that,
> but it is guarded on '#ifdef SOLIB_ADD'. It would be a matter
> of exposing it always.
>
> Any ideas? Perhaps something simpler I'm not seing?
>
> Daniel, I once saw somewhere on the archives that
> you have once made win32 dlls work with gdbserver. I can't
> find that pointer now, though. Do you have at hand that
> implementation, or remember the interface you used/implemented?
>
> Cheers,
> Pedro Alves
>
next prev parent reply other threads:[~2007-04-26 22:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-26 16:41 Pedro Alves
2007-04-26 22:27 ` Pedro Alves [this message]
2007-04-26 22:44 ` Daniel Jacobowitz
2007-04-26 23:34 ` Pedro Alves
2007-04-30 2:45 ` Daniel Jacobowitz
2007-05-03 15:37 ` Daniel Jacobowitz
2007-05-03 16:11 ` Pedro Alves
2007-05-03 20:08 ` Daniel Jacobowitz
2007-05-03 21:44 ` Pedro Alves
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=4631274C.5080603@portugalmail.pt \
--to=pedro_alves@portugalmail.pt \
--cc=gdb@sourceware.org \
/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