This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Fix crash when enabling "target.process.thread.trace-thread" setting
Needs ReviewPublic

Authored by vangelists on Jul 1 2019, 3:41 PM.

Details

Reviewers
jingham
Summary

Fixes the crash occurring when target.process.thread.trace-thread is enabled.

The cause of the crash was the call of a virtual method during object construction, as shown below:

virtual Process.UpdateThreadList()
└── ProcessGDBRemote.UpdateThreadList()
    └── new ThreadGDBRemote()
        └── new Thread()
            └── new ThreadPlanBase()
                ├── new ThreadPlanAssemblyTracer()
                └── virtual ThreadPlanAssemblyTracer::EnableTracing()
                    └── virtual ThreadPlanTracer::TracingStarted()
                        └── virtual Thread::GetRegisterContext() ← Virtual method call of Thread under construction!
                            └── __cxa_pure_virtual()

This patch also contains an attempt to make the tracing API a bit better and more clear.

Generated against llvm-8.0.0 git tag (commit SHA: d2298e74235598f15594fe2c99bbac870a507c59).

Diff Detail

Event Timeline

vangelists created this revision.Jul 1 2019, 3:41 PM