Skip to content

Commit

Permalink
Added option to automatically detect that the target process has fini…
Browse files Browse the repository at this point in the history
…shed and properly release Dia objects so that the pdb is no longer locked by Orbit. You can leave orbit running, recompile your application, relaunch and reconnect. No need to restart Orbit anymore. NOTE: this is a work in progress and is OFF BY DEFAULT. You can enable it by setting m_AutoReleasePdb to true in the orbit params (C:\Users\YOUR_USER_NAME\AppData\Roaming\OrbitProfiler\config\config.xml). At the moment, Orbit will detect that the target process ended only if the home tab is visible. Will be streamlined soon.
  • Loading branch information
pierricgimmig committed Jun 11, 2018
1 parent c3cef34 commit b695ce5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
4 changes: 3 additions & 1 deletion OrbitCore/Params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ Params::Params() : m_LoadTypeInfo( true )
, m_AllowUnsafeHooking(false)
, m_HookOutputDebugString(false)
, m_FindFileAndLineInfo(false)
, m_AutoReleasePdb(false)
, m_Port(1789)
, m_DiffArgs("%1 %2")
, m_NumBytesAssembly(1024)
{

}

ORBIT_SERIALIZE( Params, 11 )
ORBIT_SERIALIZE( Params, 12 )
{
ORBIT_NVP_VAL( 0, m_LoadTypeInfo );
ORBIT_NVP_VAL( 0, m_SendCallStacks );
Expand All @@ -55,6 +56,7 @@ ORBIT_SERIALIZE( Params, 11 )
ORBIT_NVP_VAL( 10, m_Arguments );
ORBIT_NVP_VAL( 10, m_WorkingDirectory );
ORBIT_NVP_VAL( 11, m_FindFileAndLineInfo );
ORBIT_NVP_VAL( 12, m_AutoReleasePdb );
}

//-----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions OrbitCore/Params.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct Params
bool m_AllowUnsafeHooking;
bool m_HookOutputDebugString;
bool m_FindFileAndLineInfo;
bool m_AutoReleasePdb;
int m_MaxNumTimers;
float m_FontSize;
int m_Port;
Expand Down
22 changes: 20 additions & 2 deletions OrbitGl/ProcessDataView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "Capture.h"
#include "App.h"
#include "Callstack.h"
#include "Params.h"

//-----------------------------------------------------------------------------
ProcessesDataView::ProcessesDataView()
Expand Down Expand Up @@ -181,16 +182,33 @@ void ProcessesDataView::Refresh()
//-----------------------------------------------------------------------------
void ProcessesDataView::SetSelectedItem()
{
int initialIndex = m_SelectedIndex;
m_SelectedIndex = -1;

for( int i = 0; i < GetNumElements(); ++i )
{
if( GetProcess( i ) == m_SelectedProcess )
{
m_SelectedIndex = i; //m_Indices[i];
break;
m_SelectedIndex = i;
return;
}
}

if( GParams.m_AutoReleasePdb && initialIndex != -1 )
{
ClearSelectedProcess();
}
}

//-----------------------------------------------------------------------------
void ProcessesDataView::ClearSelectedProcess()
{
shared_ptr<Process> process = std::make_shared<Process>();
Capture::SetTargetProcess( process );
m_ModulesDataView->SetProcess( process );
m_SelectedProcess = process;
GPdbDbg = nullptr;
GOrbitApp->FireRefreshCallbacks();
}

//-----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions OrbitGl/ProcessDataView.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ProcessesDataView : public DataViewModel

protected:
std::shared_ptr<Process> GetProcess( unsigned int a_Row ) const;
void ClearSelectedProcess();

ProcessList m_ProcessList;
std::shared_ptr<Process> m_RemoteProcess;
Expand Down

0 comments on commit b695ce5

Please sign in to comment.