Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hannes Domani <ssbssa@yahoo.de>
To: Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v3 00/29] Windows code sharing + bug fix
Date: Thu, 9 Apr 2020 15:08:11 +0000 (UTC)	[thread overview]
Message-ID: <742051217.5730225.1586444891056@mail.yahoo.com> (raw)
In-Reply-To: <b3e5fca6-2093-7404-84a0-0757ddfaef51@dronecode.org.uk>

 Am Donnerstag, 9. April 2020, 16:57:38 MESZ hat Jon Turney <jon.turney@dronecode.org.uk> Folgendes geschrieben:

> On 09/04/2020 03:49, Tom Tromey wrote:
>
> >>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
> >
> > Hannes> I seems I kinda missed to actually use Wow64SuspendThread when I implemented
> > Hannes> the WOW64 stuff.
> >
> > Could you double-check to make sure I didn't mess it up when rebasing
> > this series over your patches?
> >
> > Hannes> Maybe I should just try to implement the WOW64 stuff for gdbserver as well, and
> > Hannes> then try to move more shared stuff into nat/windows-nat.c?
> >
> > It would be nice to try to keep the code more in sync.
> > They still aren't identical but they do share quite a bit more now.
> > So, unless it's unusually hard, I would say yes.
>
>
> I wonder if SuspendThread() is actually needed at all, since it doesn't
> make a huge amount of sense for the debugee to still be running when
> WaitForDebugEvent() returns.

I took me quite a while to figure out a situation where SuspendThread() was
actually called.

And I can get there if I start the target process in a new console, and then
press ctrl-c in there so I get the DBG_CONTROL_C exception.
And then do something with threads, either "thread 1" or "info threads".

The backtrace then looks like this:
Thread 1 hit Breakpoint 1, 0x0000000077182a60 in SuspendThread () from C:\Windows\system32\kernel32.dll
(gdb) bt
#0  0x0000000077182a60 in SuspendThread () from C:\Windows\system32\kernel32.dll
#1  0x00000000005b9d32 in windows_nat::windows_thread_info::suspend (this=this@entry=0x11c79100) at C:/src/repos/binutils-gdb.git/gdb/nat/windows-nat.c:63
#2  0x00000000006c7e09 in windows_nat::thread_rec (ptid=..., disposition=disposition@entry=windows_nat::INVALIDATE_CONTEXT)
    at C:/src/repos/binutils-gdb.git/gdb/windows-nat.c:406
#3  0x00000000006c7e5e in windows_nat_target::fetch_registers (this=<optimized out>, regcache=0x11d053f0, r=8)
    at C:/src/repos/binutils-gdb.git/gdb/regcache.h:383
#4  0x000000000066ab3c in target_fetch_registers (regcache=regcache@entry=0x11d053f0, regno=regno@entry=8) at C:/src/repos/binutils-gdb.git/gdb/target.h:1326
#5  0x00000000005ec6ca in regcache::raw_update (regnum=8, this=0x11d053f0) at C:/src/repos/binutils-gdb.git/gdb/regcache.c:499
#6  regcache::raw_update (this=0x11d053f0, regnum=<optimized out>) at C:/src/repos/binutils-gdb.git/gdb/regcache.c:488
#7  0x00000000005ed51e in readable_regcache::raw_read (this=0x11d053f0, regnum=8, buf=0x11d33e70 "") at C:/src/repos/binutils-gdb.git/gdb/regcache.c:513
#8  0x00000000005ee1bf in readable_regcache::cooked_read_value (this=0x11d053f0, regnum=8) at C:/src/repos/binutils-gdb.git/gdb/regcache.c:663
#9  0x000000000061af87 in sentinel_frame_prev_register (this_frame=<optimized out>, this_prologue_cache=<optimized out>, regnum=<optimized out>)
    at C:/src/repos/binutils-gdb.git/gdb/sentinel-frame.c:53
#10 0x0000000000527546 in frame_unwind_register_value (next_frame=next_frame@entry=0x11837cf0, regnum=regnum@entry=8)
    at C:/src/repos/binutils-gdb.git/gdb/frame.c:1229
#11 0x000000000052780d in frame_register_unwind (next_frame=next_frame@entry=0x11837cf0, regnum=regnum@entry=8, optimizedp=optimizedp@entry=0xfd5f4b8,
    unavailablep=unavailablep@entry=0xfd5f4bc, lvalp=lvalp@entry=0xfd5f4c4, addrp=addrp@entry=0xfd5f4c8, realnump=realnump@entry=0xfd5f4c0,
    bufferp=bufferp@entry=0xfd5f508 "@˜+\017") at C:/src/repos/binutils-gdb.git/gdb/frame.c:1132
#12 0x0000000000527b99 in frame_unwind_register (next_frame=next_frame@entry=0x11837cf0, regnum=8, buf=buf@entry=0xfd5f508 "@˜+\017")
    at C:/src/repos/binutils-gdb.git/gdb/frame.c:1188
#13 0x000000000054d9d7 in i386_unwind_pc (gdbarch=0x118ae400, next_frame=0x11837cf0) at C:/src/repos/binutils-gdb.git/gdb/i386-tdep.c:1971
#14 0x0000000000526eb0 in frame_unwind_pc (this_frame=0x11837cf0) at C:/src/repos/binutils-gdb.git/gdb/frame.c:928
#15 0x0000000000527010 in get_frame_pc (frame=0x11837dc0) at C:/src/repos/binutils-gdb.git/gdb/frame.c:2399
#16 get_frame_address_in_block (this_frame=0x11837dc0) at C:/src/repos/binutils-gdb.git/gdb/frame.c:2429
#17 0x00000000005270bf in get_frame_address_in_block_if_available (this_frame=<optimized out>, pc=pc@entry=0xfd5f628)
    at C:/src/repos/binutils-gdb.git/gdb/frame.c:2492
#18 0x0000000000527240 in select_frame (fi=<optimized out>) at C:/src/repos/binutils-gdb.git/gdb/frame.c:1738
#19 0x0000000000528627 in select_frame (fi=<optimized out>) at C:/src/repos/binutils-gdb.git/gdb/frame.c:1727
#20 get_selected_frame (message=message@entry=0x0) at C:/src/repos/binutils-gdb.git/gdb/frame.c:1680
#21 0x00000000006712a5 in print_thread_info_1 (uiout=0x118b6f00, requested_threads=0x0, global_ids=0, pid=-1, show_global_ids=0)
    at C:/src/repos/binutils-gdb.git/gdb/thread.c:1193
#22 0x0000000000671ed7 in info_threads_command (arg=<optimized out>, from_tty=<optimized out>) at C:/src/repos/binutils-gdb.git/gdb/thread.c:1284
#23 0x0000000000480d22 in cmd_func (cmd=0xf4, args=0x2 <error: Cannot access memory at address 0x2>, from_tty=7976)
    at C:/src/repos/binutils-gdb.git/gdb/cli/cli-decode.c:1952
#24 0x0000000000674638 in execute_command (p=<optimized out>, p@entry=0x11c68790 "info threads", from_tty=1) at C:/src/repos/binutils-gdb.git/gdb/top.c:655
#25 0x0000000000516054 in command_handler (command=0x11c68790 "info threads") at C:/src/repos/binutils-gdb.git/gdb/event-top.c:587
#26 0x0000000000516f02 in command_line_handler (rl=...) at C:/src/repos/binutils-gdb.git/gdb/event-top.c:772
#27 0x0000000000516833 in gdb_rl_callback_handler (rl=0x11805f60 "info threads")
    at c:/msys64/mingw64/x86_64-w64-mingw32/include/c++/9.3.0/bits/unique_ptr.h:153
#28 0x00000000006e60fc in rl_callback_read_char () at C:/src/repos/binutils-gdb.git/readline/readline/callback.c:281
#29 0x00000000006e633f in rl_callback_read_char () at C:/src/repos/binutils-gdb.git/readline/readline/callback.c:222
#30 0x0000000000515bae in gdb_rl_callback_read_char_wrapper_noexcept () at C:/src/repos/binutils-gdb.git/gdb/event-top.c:176
#31 0x00000000005166e4 in gdb_rl_callback_read_char_wrapper (client_data=<optimized out>) at C:/src/repos/binutils-gdb.git/gdb/event-top.c:192
#32 0x00000000005159f2 in stdin_event_handler (error=<optimized out>, client_data=0x1180b720) at C:/src/repos/binutils-gdb.git/gdb/event-top.c:515
#33 0x0000000000514a10 in handle_file_event (ready_mask=2, file_ptr=0x11ce4ee0) at C:/src/repos/binutils-gdb.git/gdb/event-loop.c:701
#34 gdb_wait_for_event (block=<optimized out>) at C:/src/repos/binutils-gdb.git/gdb/event-loop.c:852
#35 gdb_wait_for_event (block=<optimized out>) at C:/src/repos/binutils-gdb.git/gdb/event-loop.c:714
#36 0x0000000000514bee in gdb_do_one_event () at C:/src/repos/binutils-gdb.git/gdb/event-loop.c:313
#37 0x0000000000514cde in gdb_do_one_event () at C:/src/repos/binutils-gdb.git/gdb/event-loop.c:337
#38 start_event_loop () at C:/src/repos/binutils-gdb.git/gdb/event-loop.c:337
#39 0x0000000000593ce2 in captured_command_loop () at C:/src/repos/binutils-gdb.git/gdb/main.c:360
#40 0x0000000000595b05 in captured_main (data=0xfd5fdc0) at C:/src/repos/binutils-gdb.git/gdb/main.c:1198
#41 gdb_main (args=args@entry=0xfd5fe20) at C:/src/repos/binutils-gdb.git/gdb/main.c:1213
#42 0x000000000098adc7 in main (argc=3, argv=0x1348a0) at C:/src/repos/binutils-gdb.git/gdb/gdb.c:32


Hannes


  reply	other threads:[~2020-04-09 15:08 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 19:08 Tom Tromey
2020-03-13 19:08 ` [PATCH v3 01/29] Remove the "next" field from windows_thread_info Tom Tromey
2020-03-13 19:08 ` [PATCH v3 02/29] Rename win32_thread_info to windows_thread_info Tom Tromey
2020-03-13 19:08 ` [PATCH v3 03/29] Rename windows_thread_info::id to "tid" Tom Tromey
2020-03-13 19:08 ` [PATCH v3 04/29] Share windows_thread_info between gdb and gdbserver Tom Tromey
2020-03-13 19:08 ` [PATCH v3 05/29] Use new and delete for windows_thread_info Tom Tromey
2020-03-13 19:08 ` [PATCH v3 06/29] Change two windows_thread_info members to "bool" Tom Tromey
2020-03-13 19:08 ` [PATCH v3 07/29] Make windows_thread_info::name a unique_xmalloc_ptr Tom Tromey
2020-03-13 19:08 ` [PATCH v3 08/29] Use lwp, not tid, for Windows thread id Tom Tromey
2020-03-13 19:08 ` [PATCH v3 09/29] Share Windows thread-suspend and -resume code Tom Tromey
2020-03-13 19:08 ` [PATCH v3 10/29] Change type of argument to windows-nat.c:thread_rec Tom Tromey
2020-03-13 19:08 ` [PATCH v3 11/29] Handle pending stops from the Windows kernel Tom Tromey
2020-03-13 19:08 ` [PATCH v3 12/29] Call CloseHandle from ~windows_thread_info Tom Tromey
2020-03-13 19:08 ` [PATCH v3 13/29] Wrap shared windows-nat code in windows_nat namespace Tom Tromey
2020-03-13 19:08 ` [PATCH v3 14/29] Share thread_rec between gdb and gdbserver Tom Tromey
2020-03-13 19:08 ` [PATCH v3 15/29] Share get_image_name " Tom Tromey
2020-03-13 19:08 ` [PATCH v3 16/29] Share some Windows-related globals Tom Tromey
2020-03-13 19:08 ` [PATCH v3 17/29] Normalize handle_output_debug_string API Tom Tromey
2020-03-13 19:08 ` [PATCH v3 18/29] Fix up complaints.h for namespace use Tom Tromey
2020-03-13 19:08 ` [PATCH v3 19/29] Share handle_load_dll and handle_unload_dll declarations Tom Tromey
2020-03-13 19:08 ` [PATCH v3 20/29] Remove some globals from windows-nat.c Tom Tromey
2020-03-13 19:08 ` [PATCH v3 21/29] Share handle_exception Tom Tromey
2020-04-15 15:27   ` Simon Marchi
2020-04-15 16:54     ` Tom Tromey
2020-04-15 17:54       ` Simon Marchi
2020-04-15 19:13         ` Tom Tromey
2020-04-16  0:52           ` Simon Marchi
2020-03-13 19:08 ` [PATCH v3 22/29] Share some inferior-related Windows code Tom Tromey
2020-03-13 19:08 ` [PATCH v3 23/29] Introduce fetch_pending_stop Tom Tromey
2020-03-13 19:08 ` [PATCH v3 24/29] Move wait_for_debug_event to nat/windows-nat.c Tom Tromey
2020-03-13 19:08 ` [PATCH v3 25/29] Make last_wait_event static Tom Tromey
2020-03-13 19:08 ` [PATCH v3 26/29] Add read_pc / write_pc support to win32-low Tom Tromey
2020-03-13 19:08 ` [PATCH v3 27/29] Introduce win32_target_ops::decr_pc_after_break Tom Tromey
2020-03-13 19:08 ` [PATCH v3 28/29] Implement stopped_by_sw_breakpoint for Windows gdbserver Tom Tromey
2020-03-13 19:08 ` [PATCH v3 29/29] Add pending stop support to gdbserver's Windows port Tom Tromey
2020-04-16  1:11   ` [pushed] gdbserver: fix format string warning in win32-low.cc (was: Re: [PATCH v3 29/29] Add pending stop support to gdbserver's Windows port) Simon Marchi
2020-04-08 20:33 ` [PATCH v3 00/29] Windows code sharing + bug fix Tom Tromey
2020-04-08 22:17   ` Hannes Domani
2020-04-09  2:49     ` Tom Tromey
2020-04-09 14:57       ` Jon Turney
2020-04-09 15:08         ` Hannes Domani [this message]
2020-04-09 17:54         ` Tom Tromey

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=742051217.5730225.1586444891056@mail.yahoo.com \
    --to=ssbssa@yahoo.de \
    --cc=gdb-patches@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