Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Issues
  • #3530
Closed
Open
Issue created Apr 10, 2019 by Felix Moessbauer@fmoessbauerContributor

STL cout in a client does not work in common terminals

Using std::cout (and std::cin) in a DR client does not work in common terminals:

OS: Version 10.0.17134 Build 17134 DR: 7.1.17984 (older versions as well)

Behavior:

std::cout:

  • MinGW / GitBash: works as expected
  • CMD: No output (client continues without other errors)
  • PowerShell: No output (client continues without other errors)

std::cin

  • MinGW / GitBash: works as expected
  • CMD: blocks indefinitely
  • Powershell: blocks indefinitely

Reproducer

drrun.exe -c samples/bin64/stl_test.dll -- notepad.exe (No output, with -debug no output as well)

WindBg Output

break after some waiting time:

0:004> g
ModLoad: 00000203`6c950000 00000203`6ca02000   KERNEL32.dll
ModLoad: 00000203`6ca10000 00000203`6cc83000   KERNELBASE.dll
WARNING: Break-in timed out, suspending.
         This is usually caused by another thread holding the loader lock
(45bc.45c0): Wake debugger - code 80000007 (first chance)
KERNEL32_2036c950000!GetConsoleMode:
00000203`6c971400 ff25fa600500    jmp     qword ptr [KERNEL32_2036c950000!_imp_GetConsoleMode (00000203`6c9c7500)] ds:00000203`6c9c7500={KERNEL32_2036c950000!GetConsoleMode (00000203`6c971400)}
0:000> ~* kb

.  0  Id: 45bc.45c0 Suspend: 1 Teb: 00000068`6cf18000 Unfrozen
 # RetAddr           : Args to Child                                                           : Call Site
00 00007ff7`7f4e3fb3 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32_2036c950000!GetConsoleMode
01 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : 0x00007ff7`7f4e3fb3

   1  Id: 45bc.45c4 Suspend: 1 Teb: 00000068`6cf1a000 Unfrozen
 # RetAddr           : Args to Child                                                           : Call Site
00 00007ffe`eb996866 : 00000000`00000000 00000000`00000000 00007ffe`eb99a150 00000000`00000010 : ntdll!NtWaitForWorkViaWorkerFactory+0x14
01 00007ffe`ea043dc4 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!TppWorkerThread+0x536
02 00007ffe`eb9e3691 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x14
03 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21

   2  Id: 45bc.45c8 Suspend: 1 Teb: 00000068`6cf1c000 Unfrozen
 # RetAddr           : Args to Child                                                           : Call Site
00 00007ffe`eb996866 : 00000000`00000000 00000000`00000000 00007ffe`eb99a150 00000000`00000010 : ntdll!NtWaitForWorkViaWorkerFactory+0x14
01 00007ffe`ea043dc4 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!TppWorkerThread+0x536
02 00007ffe`eb9e3691 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x14
03 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21

   3  Id: 45bc.45cc Suspend: 1 Teb: 00000068`6cf1e000 Unfrozen
 # RetAddr           : Args to Child                                                           : Call Site
00 00007ffe`eb996866 : 00000000`00000000 00000000`00000000 00007ffe`eb99a150 00000000`00000010 : ntdll!NtWaitForWorkViaWorkerFactory+0x14
01 00007ffe`ea043dc4 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!TppWorkerThread+0x536
02 00007ffe`eb9e3691 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x14
03 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21

   4  Id: 45bc.4658 Suspend: 1 Teb: 00000068`6cf22000 Unfrozen
 # RetAddr           : Args to Child                                                           : Call Site
00 00000000`710aed55 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!NtYieldExecution+0x14
01 00000000`710ad7c9 : 00000068`6d17f1d8 00000000`00000000 00000000`00000000 00000000`00000000 : dynamorio!possible_new_thread_wait_for_dr_init+0x65 [c:\projects\dynamorio\core\win32\callback.c @ 3061] 
02 00000000`711528dc : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : dynamorio!intercept_ldr_init+0x19 [c:\projects\dynamorio\core\win32\callback.c @ 3373] 
03 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : dynamorio!interception_code_array+0x8dc
Assignee
Assign to
Time tracking