Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: PATCH: Enable x86 XML target descriptions
Date: Mon, 22 Feb 2010 15:27:00 -0000	[thread overview]
Message-ID: <6dc9ffc81002220727k50e97d86waac51e92f5e3315@mail.gmail.com> (raw)
In-Reply-To: <201002221501.o1MF1Qrq024363@glazunov.sibelius.xs4all.nl>

On Mon, Feb 22, 2010 at 7:01 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Mon, 22 Feb 2010 06:17:29 -0800
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>
>> >> +/* Get Linux/x86 target description from running target.  */
>> >> +
>> >> +static const struct target_desc *
>> >> +amd64_linux_read_description (struct target_ops *ops)
>> >> +{
>> >> +  if (gdbarch_ptr_bit (target_gdbarch) == 64)
>> >> +    return tdesc_amd64_linux;
>> >> +  else
>> >> +    return tdesc_i386_linux;
>> >> +}
>> >> +
>> >
>> > This made me wonder what happens if you attach to a process without
>> > loading an executable first.  Currently this works, since GDB can
>> > figure out what executable belongs to the the process and load the
>> > executable automatically.  But I fear a chicken & egg problem here:
>> > the gdbarch is derviced from the tdesc, but in order to determine the
>> > tdesc you need a gdbarch.
>>
>> How do you attach to a process without loading an executable first?
>> Gdb has to load something to debug. Do you have a testcase? I will
>> fix it if it doesn't work already.
>
> $ gdb
> ...
> (gdb) attach PID
>
>

It works fine. amd64_linux_read_description is called via

(gdb) att 20026
Attaching to process 20026
Reading symbols from /export/home/hjl/bugs/gdb/xml/p...done.
Detaching after fork from child process 20039.

Breakpoint 3, amd64_linux_read_description (ops=0xa94900)
    at /export/gnu/import/git/gdb-avx/gdb/amd64-linux-nat.c:681
681     {
Missing separate debuginfos, use: debuginfo-install
expat-2.0.1-8.fc12.x86_64 glibc-2.11.1-2.2.f12.x86_64
ncurses-libs-5.7-3.20090207.fc12.x86_64 python-2.6.2-2.fc12.x86_64
python-libs-2.6.2-2.fc12.x86_64 zlib-1.2.3-23.fc12.x86_64
(top-gdb) bt
#0  amd64_linux_read_description (ops=0xa94900)
    at /export/gnu/import/git/gdb-avx/gdb/amd64-linux-nat.c:681
#1  0x000000000054be91 in target_read_description (
    target=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/target.c:2252
#2  0x00000000005c423a in target_find_description ()
    at /export/gnu/import/git/gdb-avx/gdb/target-descriptions.c:279
#3  0x000000000051e266 in post_create_inferior (target=0xa74be0, from_tty=1)
    at /export/gnu/import/git/gdb-avx/gdb/infcmd.c:402
#4  0x000000000051e36f in attach_command_post_wait (
    args=<value optimized out>, from_tty=1, async_exec=0)
    at /export/gnu/import/git/gdb-avx/gdb/infcmd.c:2249
#5  0x000000000051e7fd in attach_command (args=0xa77104 "20026", from_tty=1)
    at /export/gnu/import/git/gdb-avx/gdb/infcmd.c:2426
#6  0x00000000004559eb in execute_command (p=0xa77108 "6", from_tty=1)
    at /export/gnu/import/git/gdb-avx/gdb/top.c:441
#7  0x0000000000535947 in command_handler (command=0xa77100 "")
    at /export/gnu/import/git/gdb-avx/gdb/event-top.c:511
#8  0x0000000000536564 in command_line_handler (rl=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/event-top.c:736
#9  0x00000000005fb487 in rl_callback_read_char ()
    at /export/gnu/import/git/gdb-avx/readline/callback.c:205
#10 0x0000000000535a79 in rl_callback_read_char_wrapper (
---Type <return> to continue, or q <return> to quit---
    client_data=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/event-top.c:178
#11 0x00000000005343a8 in process_event ()
    at /export/gnu/import/git/gdb-avx/gdb/event-loop.c:393
#12 0x00000000005354da in gdb_do_one_event (data=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/event-loop.c:458
#13 0x000000000052f75b in catch_errors (func=<value optimized out>,
    func_args=<value optimized out>, errstring=<value optimized out>,
    mask=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/exceptions.c:510
#14 0x00000000004bf610 in tui_command_loop (data=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/tui/tui-interp.c:154
#15 0x000000000044d489 in captured_command_loop (data=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/main.c:226
#16 0x000000000052f75b in catch_errors (func=<value optimized out>,
    func_args=<value optimized out>, errstring=<value optimized out>,
    mask=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/exceptions.c:510
#17 0x000000000044cebe in captured_main (data=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/main.c:905
#18 0x000000000052f75b in catch_errors (func=<value optimized out>,
    func_args=<value optimized out>, errstring=<value optimized out>,
    mask=<value optimized out>)
---Type <return> to continue, or q <return> to quit---
    at /export/gnu/import/git/gdb-avx/gdb/exceptions.c:510
#19 0x000000000044c354 in gdb_main (args=0x0)
    at /export/gnu/import/git/gdb-avx/gdb/main.c:914
#20 0x000000000044c31e in main (argc=10957472, argv=<value optimized out>)
    at /export/gnu/import/git/gdb-avx/gdb/gdb.c:33
(top-gdb)



-- 
H.J.


  reply	other threads:[~2010-02-22 15:27 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 20:03 H.J. Lu
2010-02-17 14:59 ` H.J. Lu
2010-02-17 15:23   ` Mark Kettenis
2010-02-17 15:42     ` H.J. Lu
2010-02-17 15:46       ` Daniel Jacobowitz
2010-02-17 16:19         ` Mark Kettenis
2010-02-18  5:44 ` H.J. Lu
2010-02-18 15:37   ` H.J. Lu
2010-02-18 23:01     ` H.J. Lu
2010-02-22 13:42       ` Mark Kettenis
2010-02-22 14:17         ` H.J. Lu
2010-02-22 15:01           ` Mark Kettenis
2010-02-22 15:27             ` H.J. Lu [this message]
2010-02-22 15:30               ` Daniel Jacobowitz
2010-02-22 15:39                 ` H.J. Lu
2010-02-28 20:30           ` Mark Kettenis
2010-02-28 20:58             ` H.J. Lu
2010-02-28 22:23               ` Daniel Jacobowitz
2010-02-22 14:41         ` Daniel Jacobowitz
2010-02-22 15:34           ` H.J. Lu
2010-02-22 15:52             ` Daniel Jacobowitz
2010-02-22 15:58               ` H.J. Lu
2010-02-22 16:10                 ` Daniel Jacobowitz
2010-02-22 16:58                   ` Mark Kettenis
2010-02-22 17:03                     ` Daniel Jacobowitz
2010-02-22 19:52                       ` Mark Kettenis
2010-02-22 21:06                         ` H.J. Lu
2010-02-22 21:31                           ` Mark Kettenis
2010-02-22 21:41                             ` H.J. Lu
2010-02-22 22:05                               ` H. Peter Anvin
2010-02-22 22:07                                 ` H.J. Lu
2010-02-22 22:15                                   ` H. Peter Anvin
2010-02-22 22:21                                     ` H.J. Lu
2010-02-28 20:12                               ` Mark Kettenis
2010-02-22 21:04       ` H.J. Lu
2010-02-28 21:16         ` H.J. Lu
2010-03-01 14:49           ` Mark Kettenis
2010-03-01 17:07             ` Daniel Jacobowitz
2010-03-01 17:09               ` H.J. Lu

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=6dc9ffc81002220727k50e97d86waac51e92f5e3315@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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