summaryrefslogtreecommitdiff
path: root/src/debug
AgeCommit message (Collapse)AuthorFilesLines
2018-07-06Remove relocations for vtable chunks (#17147)Gleb Balykov2-14/+38
* Separate sections READONLY_VCHUNKS and READONLY_DICTIONARY * Remove relocations for second-level indirection of Vtable in case FEATURE_NGEN_RELOCS_OPTIMIZATIONS is enabled. Introduce FEATURE_NGEN_RELOCS_OPTIMIZATIONS, under which NGEN specific relocations optimizations are enabled * Replace push/pop of R11 in stubs with - str/ldr of R4 in space reserved in epilog for non-tail calls - usage of R4 with hybrid-tail calls (same as for EmitShuffleThunk) * Replace push/pop of R11 for function epilog with usage of LR as helper register right before its restore from stack
2018-07-06Fix x86/Linux ICorDebug frames APIIgor Kulaychuk2-17/+17
2018-04-07Fix OpenVirtualProcess SIGSEGV on Linux. (#17444)Mike McLaughlin2-43/+133
Add DBI OpenVirtualProcessImpl2 that takes a module path instead of handle. Fix assert on Windows debug. Issue #17446
2018-04-05Rename conflicting definitions VER_MAJOR/MINORVERSION macros (#17364)Jan Kotas2-6/+6
* Rename conflicting definitions of VER_MAJOR/MINORVERSION These macros are defined by Windows SDK. They were overload to mean CLR version that was causing interesting redefinition issues. * Delete workaround for redefined Windows SDK macros * Delete ProjectN version * Delete dead code
2018-03-31Delete dead code to support OSes prior to Windows 7 (#17367)Jan Kotas2-51/+2
2018-03-23Fix Linux/x86 FuncEvalHijack stack alignment (#17143)Igor Kulaychuk1-1/+5
2018-03-19Add new ICLRDebuggingLibraryProvider2 interface for OpenVirtualProces that ↵Mike McLaughlin1-80/+134
works on Linux (#16978) Add new ICLRDebuggingLibraryProvider2 interface for OpenVirtualProcess that works on Linux. The old ICLRDebuggingLibraryProvider::ProviderLibrary returns module handles that can't be properly supported on Linux. ICLRDebuggerLibraryProvider2 returns the module path string instead of a handle. Works on both Windows and Linux. If ICLRDebuggerLibraryProvider2 is QI'ed, OpenVirtualProcess will NOT fall back to ICLRDebuggerLibraryProvider if ProviderLibrary2 fails. HRESULT ProvideLibrary2( [in] const WCHAR* pwszFileName, [in] DWORD dwTimestamp, [in] DWORD dwSizeOfImage, [out] LPWSTR* ppResolvedModulePath); ppResolvedModulePath - Where *ppResolvedModulePath is a null terminated path to the module dll. On Windows it should be allocated with CoTaskMemAlloc. On Unix it should be allocated with malloc. Failure leave it untouched.
2018-03-17Add environment variable (COMPlus_EnableDiagnostics) to disable debugging ↵Mike McLaughlin3-73/+42
and profiling. (#16141) This reverts commit e9985126acb0f1efd7c780faac4e66bc798b73c0.
2018-03-13Revert "Revert "Fix handling of incorrect assemblies on Unix (#16747)" ↵Jan Kotas1-1/+1
(#16790)" (#16917) This reverts commit 47bef69b68a35eafa069d08187727684a5f47901.
2018-03-06Revert "Fix handling of incorrect assemblies on Unix (#16747)" (#16790)Jan Kotas1-1/+1
This reverts commit 383736b96b643ba46ad290fc86601fc2d62a9436.
2018-03-05Fix handling of incorrect assemblies on Unix (#16747)Ruben Ayrapetyan1-1/+1
* Return DPTR from PEDecoder::FindFirstSection() Change type of the function's return value to PTR_IMAGE_SECTION_HEADER instead of (IMAGE_SECTION_HEADER *) * Fix handling of incorrect assemblies on Unix This fixes the regression that was introduced by #10772 and is caused by a missing check for validity of loaded assembly file. Related issue: #15544
2018-02-26Fixed mixed mode attach/JIT debugging. (#16552)Mike McLaughlin6-284/+197
Fixed mixed mode attach/JIT debugging. The mixed mode debugging attach uses TLS slot to communicate between debugger break-in thread and the right side. Unfortunately, the __thread static variables cannot be used on debugger breakin thread because of it does not have storage allocated for them. The fix is to switch the storage for debugger word to classic TlsAlloc allocated slot that works fine on debugger break-in thread. There was also problem (that is also in 2.0) where the WINNT_OFFSETOF__TEB__ThreadLocalStoragePointer was using the define for 64/32 bit and ended up always the 32 bit Windows value. This caused the right side GetEEThreadValue, GetEETlsDataBlock unmanaged thread functions to always fail.
2018-02-22Remove relocations for MethodTable::m_pParentMethodTable for Linux ARM (#15915)gbalykov1-2/+2
2018-02-17delete unused mirror files (#16423)Sergey Andreenko36-36/+0
2018-02-11Fix stack trace population to get proper source/line info for tier 1 methods ↵Koundinya Veluri3-15/+31
(#16302) Fixes https://github.com/dotnet/coreclr/issues/16224
2018-02-09Debugger api to set a breakpoint on offset 0 of all methods (#16303)David Mason8-42/+108
* Debugger api to set a breakpoint on offset 0 of all methods * fix ifdef misplacement in pal cordebug.h * add IID to cordebug_i.cpp
2018-02-09Revert "Debugger api to set a breakpoint on offset 0 of all methods (#15819)"Jan Kotas8-108/+42
This reverts commit 3d689d00843618105e735c5647e1cb64e721a333.
2018-02-09Revert "fix for issue #16289 (#16291)"Jan Kotas1-1/+1
This reverts commit cd3f6e77757729d3d02dfbec4af21cdfe83f5435.
2018-02-09fix for issue #16289 (#16291)David Mason1-1/+1
2018-02-08Debugger api to set a breakpoint on offset 0 of all methods (#15819)David Mason8-42/+108
* Debugger api to set a breakpoint on offset 0 of all methods * code review feedback * more code review feedback * respect IsIl in CorDbFunctionBreakoint() * change SIMPLIFYING_ASSERT to SIMPLIFYING_ASSUMPTION_SUCCEEDED for hrs, it outputs a much better diagnostic message
2018-02-02Fix GetILToNativeMapping3 to return mappings for the specified code start ↵Koundinya Veluri3-27/+49
address (#16146) Fix GetILToNativeMapping3 to return mappings for the specified code start address Fix for https://github.com/dotnet/coreclr/issues/16145 in master: - Previously, it was getting or creating the current entry point's corresponding DebugJitInfo and determining that the specified code address is not within the code range - Fixed to get or create a DebugJitInfo corresponding to the specified code address and return that
2018-01-25Revert "Add environment variable (COMPlus_EnableDiagnostics) to disable ↵Russ Keldorph3-42/+73
debugging and profiling. (#15878)" This reverts commit 5bcfde404803f85451cf0ee9fd6406734cb878ff.
2018-01-24Add "CLRJitAttachState" global export from coreclr.dll that contains the ↵Mike McLaughlin2-15/+10
CLR_DEBUGGING_PROCESS_FLAGS for VS. (#15973)
2018-01-17Add environment variable (COMPlus_EnableDiagnostics) to disable debugging ↵Mike McLaughlin3-73/+42
and profiling. (#15878) To disable the named pipes and semaphores created on linux execute "export COMPlus_EnableDiagnostics=0" before start the .NET Core program. On Windows execute "set COMPlus_EnableDiagnostics=0" and on Linux execute "export "COMPlus_EnableDiagnostics=0" Removed the "Telesto" registry entry (old unnecessary Silverlight code) and Watson (always true) checks. For issues #11769 and #8844.
2018-01-13Revert "Remove relocations for MethodTable::m_pParentMethodTable for Linux ARM"Jan Kotas1-2/+2
This reverts commit cf1fb9e17fc8b6ee849edab5a696d0ec5c6eadd2.
2017-12-27Resolve race in ShimProxyCallback::AddRef (#15643)Ben Adams1-2/+1
2017-12-06new intrinsic type support (#15340)Fei Peng1-0/+1
2017-11-30Jumpstub fixes (#15296)Jan Kotas1-3/+1
- Reserve space for jump stubs for precodes and other code fragments at the end of each code heap segment. This is trying to ensure that eventual allocation of jump stubs for precodes and other code fragments succeeds. Accounting is done conservatively - reserves more than strictly required. It wastes a bit of address space, but no actual memory. Also, this reserve is not used to allocate jump stubs for JITed code since the JITing can recover from failure to allocate the jump stub now. Fixes #14996. - Improve algorithm to reuse HostCodeHeap segments: Maintain estimated size of the largest free block in HostCodeHeap. This estimate is updated when allocation request fails, and also when memory is returned to the HostCodeHeap. Fixes #14995. - Retry JITing on failure to allocate jump stub. Failure to allocate jump during JITing is not fatal anymore. There is extra memory reserved for jump stubs on retry to ensure that the retry succeeds allocating the jump stubs that it needs with high probability. - Respect CodeHeapRequestInfo::getRequestSize for HostCodeHeap. CodeHeapRequestInfo::getRequestSize is used to throttle code heap segment size for large workloads. Not respecting it in HostCodeHeap lead to too many too small code heap segments in large workloads. - Switch HostCodeHeap nibble map to be allocated on regular heap as part. It simplied the math required to estimate the nibble map size, and allocating on regular heap is overall goodness since it does not need to be executable.
2017-11-27Improve Monitor scaling (#14216)Koundinya Veluri1-3/+3
Improve Monitor scaling and reduce spinning Part 1: Improve Monitor scaling Fixes https://github.com/dotnet/coreclr/issues/13978 - Refactored AwareLock::m_MonitorHeld into a class LockState with operations to mutate the state - Allowed the lock to be taken by a non-waiter when there is a waiter to prevent creating lock convoys - Added a bit to LockState to indicate that a waiter is signaled to wake, to avoid waking more than one waiter at a time. A waiter that wakes by observing the signal unsets this bit. See AwareLock::EnterEpilogHelper(). - Added a spinner count to LockState. Spinners now register and unregister themselves and lock releasers don't wake a waiter when there is a registered spinner (the spinner guarantees to take the lock if it's available when unregistering itself) - This was necessary mostly on Windows to reduce CPU usage to the expected level in contended cases with several threads. I believe it's the priority boost Windows gives to signaled threads, which seems to cause waiters to much more frequently succeed in acquiring the lock. This causes a CPU usage problem because once the woken waiter releases the lock, on the next lock attempt it will become a spinner. This keeps repeating, converting several waiters into spinners unnecessarily. Before registering spinners, I saw typically 4-6 spinners under contention (with delays inside and outside the lock) when I expected to have only 1-2 spinners at most. - It costs an interlocked operation before and after the spin loop, doesn't seem to be too significant since spinning is a relatively slow path anyway, and the reduction in CPU usage in turn reduces contention on the lock and lets more useful work get done - Updated waiters to spin a bit before going back to waiting, reasons are explained in AwareLock::EnterEpilogHelper() - Removed AwareLock::Contention() and any references (this removes the 10 repeats of the entire spin loop in that function). With the lock convoy issue gone, this appears to no longer be necessary. Perf - On Windows, throughput has increased significantly starting at slightly lower than proc count threads. On Linux, latency and throughput have increased more significantly at similar proc counts. - Most of the larger regressions are in the unlocked fast paths. The code there hasn't changed and is almost identical (minor layout differences), I'm just considering this noise until we figure out how to get consistently faster code generated. - The smaller regressions are within noise range Part 2: Reduce Monitor spinning Fixes https://github.com/dotnet/coreclr/issues/13980 - Added new config value Monitor_SpinCount and Monitor spins for that many iterations, default is 30 (0x1e). This seems to give a somewhat decent balance between latency, fairness, and throughput. Lower spin counts improve latency and fairness significantly and regress throughput slightly, and higher spin counts improve throughput slightly and regress latency and fairness significantly. - The other constants can still be used to disable spinning but otherwise they are no longer used by Monitor - Decreased the number of bits used for tracking spinner count to 3. This seems to be more than enough since only one thread can take a lock at a time, and prevents spikes of unnecessary CPU usage. Tried some things that didn't pan out: - Sleep(0) doesn't seem to add anything to the spin loop, so left it out. Instead of Sleep(0) it can just proceed to waiting. Waiting is more expensive than Sleep(0), but I didn't see that benefit in the tests. Omitting Sleep(0) also keeps the spin loop very short (a few microseconds max). - Increasing the average YieldProcessor() duration per spin iteration improved thorughput slightly but regressed latency and fairness very quickly. Given that fairness is generally worse with part 1 of this change above, it felt like a better compromise to take a small reduction in throughput for larger improvements in latency and fairness. - Tried adding a very small % of lock releases by random wake a waiter despite there being spinners to improve fairness. This improved fairness noticeably but not as much as decreasing the spin count slightly, and it was making latency and throughput worse more quickly. After reducing the % to a point where I was hardly seeing fairness improvements, there were still noticeable latency and throughput regressions. Miscellaneous - Moved YieldProcessorNormalized code into separate files so that they can be included earlier and where needed - Added a max for "optimal max normalized yields per spin iteration" since it has a potential to be very large on machines where YieldProcessor may be implemented as no-op, in which case it's probably not worth spinning for the full duration - Refactored duplicate code in portable versions of MonEnterWorker, MonEnter, and MonReliableEnter. MonTryEnter has a slightly different structure, did not refactor that. Perf - Throughput is a bit lower than before at lower thread counts and better at medium-high thread counts. It's a bit lower at lower thread counts because of two reasons: - Shorter spin loop means the lock will be polled more frequently because the exponential backoff does not get as high, making it more likely for a spinner to steal the lock from another thread, causing the other thread to sometimes wait early - The duration of YieldProcessor() calls per spin iteration has decreased and a spinner or spinning waiter are more likely to take the lock, the rest is similar to above - For the same reasons as above, latency is better than before. Fairness is better on Windows and worse on Linux compared to baseline due to the baseline having differences between these platforms. Latency also has differences between Windows/Linux in the baseline, I suspect those are due to differences in scheduling. - Performance now scales appropriately on processors with different pause delays Part 3: Add mitigation for waiter starvation Normally, threads are allowed to preempt waiters to acquire the lock. There are cases where waiters can be easily starved as a result. For example, a thread that holds a lock for a significant amount of time (much longer than the time it takes to do a context switch), then releases and reacquires the lock in quick succession, and repeats. Though a waiter would be woken upon lock release, usually it will not have enough time to context-switch-in and take the lock, and can be starved for an unreasonably long duration. In order to prevent such starvation and force a bit of fair forward progress, it is sometimes necessary to change the normal policy and disallow threads from preempting waiters. A new bit was added to LockState and ShouldNotPreemptWaiters() indicates the current state of the policy. - When the first waiter begins waiting, it records the current time as a "waiter starvation start time". That is a point in time after which no forward progress has occurred for waiters. When a waiter acquires the lock, the time is updated to the current time. - Before a spinner begins spinning, and when a waiter is signaled to wake, it checks whether the starvation duration has crossed a threshold (currently 100 ms) and if so, sets ShouldNotPreemptWaiters() When unreasonable starvation is occurring, the lock will be released occasionally and if caused by spinners, spinners will be starting to spin. - Before starting to spin, if ShouldNotPreemptWaiters() is set, the spinner will skip spinning and wait instead. Spinners that are already registered at the time ShouldNotPreemptWaiters() is set will stop spinning as necessary. Eventually, all spinners will drain and no new ones will be registered. - After spinners have drained, only a waiter will be able to acquire the lock. When a waiter acquires the lock, or when the last waiter unregisters itself, ShouldNotPreemptWaiters() is cleared to restore the normal policy.
2017-11-20Fix a few of createdump bugs. (#15079)Mike McLaughlin6-137/+160
1) Fix createdump p_vaddr bias/base problem. 2) createdump was loading the DAC from the directory where createdump was executed from and not from the libcoreclr.so path. Fixed this. 3) Don't use the dac if the libcoreclr.so module is not found. 4) Remove the QI of ICoreDebugDataTarget4 in datatarget.cpp. Forgot to do this when the VirtualUnwind function was removed. Caused crash.
2017-11-18Delete unused Thread::YieldTask (#15091)Jan Kotas2-5/+1
2017-11-17fix for il to native mapping etw events (#15038)David Mason2-5/+7
After investigation the failures look unrelated to my changes. Thanks Jan and Noah.
2017-11-14Remove out-of-use method and properties from appdomain (#15029)Zhukov Maxim1-113/+6
Not supported on CoreCLR appdomain's method and properties were removed #15001
2017-11-02Fix arm64 buildBruce Forstall1-4/+4
to have broken the arm64 build. Fix one file by removing non-ASCII characters.
2017-10-23profiler changes for tiered compilation (#14612)David Mason2-3/+3
Add new apis for profiler to use with tiered jitting.
2017-10-16Fix stepping with tiered jittingNoah Falk5-93/+233
Fix #14426. Added a more flexible IL master breakpoint that can: a) bind to native offset 0 of each jitted code body b) use a MethodDescFilter so that only jitted code for one generic instance receives breakpoints The remaining change is simply to switch step-in and trace stepping to use that new breakpoint binding behavior instead of the code version specific binding behavior that was used before. This ensures that even if the code version changes after the trace occurs we will still have a breakpoint on the alternate code versions and complete the stepping operation.
2017-10-12Fix #14418 (#14419)Noah Falk1-1/+10
Adds the appropriate handling of the default ILCodeVersion in DacDbiInterfaceImpl::GetILCodeVersionNode
2017-10-12Fix #14427 (#14429)Noah Falk2-7/+58
Enumerate all of the jitted instances of a method using the tiered compilation manager
2017-10-11Merge pull request #14430 from noahfalk/fix_14428Noah Falk1-1/+3
Fix #14428
2017-10-11Merge pull request #14424 from noahfalk/fix_14423Noah Falk3-4/+31
Fix #14423
2017-10-11Delete !FEATURE_IMPLICIT_TLS (#14398)Jan Kotas6-186/+5
Linux and Windows arm64 are using the regular C/C++ thread local statics. This change unifies the remaining Windows architectures to be on the same plan.
2017-10-11Fix #14428noahfalk1-1/+3
Now using an offset calculation that is correct for all of a method's jitted code versions.
2017-10-11Fix #14423noahfalk3-4/+31
The JIT now invokes the debugger's JITComplete callback on every jitting of a method
2017-10-05[x86/Linux][SOS] Fix clrstack command of lldb sosplugin on x86 (#13973)Konstantin Baladurin3-3/+67
* [x86/Linux][SOS] Add support for x86 in GetContextFromFrame It's need for 'clrstack -f' command of SOS plugin on x86. * [x86/Linux] Fix RtlpGetFunctionEndAddress function We should use PTR_UNWIND_INFO instead of PUNWIND_INFO for pointer to UNWIND_INFO structure because it's pointer from other process and we need to use DAC to read data using it. * [x86/Linux][SOS] Define DEBUG_STACK_CONTEXT for x86 It's needed for 'clrstack -f' command in libsosplugin. * [x86/Linux] Fix undefined references in libmscordbi.so on x86 Asm block like following: __asm fnsave currentFPUState where currentFPUState is structure works with MSVC but leads to undefined reference currentFPUState in the binary with other compilers. So rewrite such asm blocks for them. This patch fixes error "Unable to load 'libmscordbi.so'" during execution of 'clrstack -f' command of SOS plugin on x86. * [x86/Linux] Fix calling convention inconsistency WINAPI and STDAPI are defined as __cdecl but in some cases functions with these attributes are called using stdcall calling convention. It leads to crashes during execution of 'clrstack -i' command of SOS plugin on x86.
2017-10-03[x86/Linux] Fix regdisplay initialization in case of WIN64EXCEPTIONS (#14296)Konstantin Baladurin1-1/+1
Method Debugger::IsThreadAtSafePlaceWorker for x86 sets values only for ControlPC and PCTAddr fields of REGDISPLAY but there is assert in StackFrameIterator::Init that checks that field pCurrentContext is not NULL if WIN64EXCEPTIONS is defined. This patch uses FillRegDisplay function to correctly initialize regdisplay in case of WIN64EXCEPTIONS.
2017-09-29[x86/Linux] Fix CopyREGDISPLAY for WIN64EXCEPTIONS (#14254)Konstantin Baladurin1-0/+24
When WIN64EXCEPTIONS is defined, fields pCurrentContextPointers, pCallerContextPointers, pCurrentContext and pCallerContext of the REGDISPLAY are used. So we need to fix their values after coping.
2017-09-28[x86/Linux] Fix typo in SetDebuggerREGDISPLAYFromREGDISPLAY (#14221)Konstantin Baladurin1-1/+1
Fix typo in SetDebuggerREGDISPLAYFromREGDISPLAY: Esi -> Eax.
2017-09-18Change jit notifications so that they pass the native code address. (#14021)David Mason1-4/+25
* Change jit notifications so that they pass the native code address. This fixes !bpmd so that it will set the correct breakpoint on tiered jitted methods. * code review feedback * don't handle OnCodeGenerated
2017-09-15Merge pull request #13944 from ↵Bruce Forstall1-1/+8
ayuckhulk/fix-arm-set-debuggerregdisplay-from-context [ARM] Fix SetDebuggerREGDISPLAYFromREGDISPLAY() function
2017-09-13[ARM] Fix SetDebuggerREGDISPLAYFromREGDISPLAY() functionIgor Kulaychuk1-1/+8
Use the same logic as in AMD64 code: when setting DebuggerREGDISPLAY from the context, the context flags might not be initialized. Since it is only called from stackwalker, we can copy valid integer, control, and floating point sections from the context.