~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/Main/MachineDebuggerImpl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
HRESULT MachineDebugger::FinalConstruct()
52
52
{
53
 
    unconst (mParent) = NULL;
 
53
    unconst(mParent) = NULL;
54
54
    return S_OK;
55
55
}
56
56
 
70
70
 */
71
71
HRESULT MachineDebugger::init (Console *aParent)
72
72
{
73
 
    LogFlowThisFunc (("aParent=%p\n", aParent));
 
73
    LogFlowThisFunc(("aParent=%p\n", aParent));
74
74
 
75
75
    ComAssertRet (aParent, E_INVALIDARG);
76
76
 
77
77
    /* Enclose the state transition NotReady->InInit->Ready */
78
 
    AutoInitSpan autoInitSpan (this);
79
 
    AssertReturn (autoInitSpan.isOk(), E_FAIL);
 
78
    AutoInitSpan autoInitSpan(this);
 
79
    AssertReturn(autoInitSpan.isOk(), E_FAIL);
80
80
 
81
 
    unconst (mParent) = aParent;
 
81
    unconst(mParent) = aParent;
82
82
 
83
83
    mSinglestepQueued = ~0;
84
84
    mRecompileUserQueued = ~0;
101
101
 */
102
102
void MachineDebugger::uninit()
103
103
{
104
 
    LogFlowThisFunc (("\n"));
 
104
    LogFlowThisFunc(("\n"));
105
105
 
106
106
    /* Enclose the state transition Ready->InUninit->NotReady */
107
 
    AutoUninitSpan autoUninitSpan (this);
 
107
    AutoUninitSpan autoUninitSpan(this);
108
108
    if (autoUninitSpan.uninitDone())
109
109
        return;
110
110
 
111
 
    unconst (mParent).setNull();
 
111
    unconst(mParent).setNull();
112
112
    mFlushMode = false;
113
113
}
114
114
 
125
125
{
126
126
    CheckComArgOutPointerValid(aEnabled);
127
127
 
128
 
    AutoCaller autoCaller (this);
129
 
    CheckComRCReturnRC (autoCaller.rc());
 
128
    AutoCaller autoCaller(this);
 
129
    CheckComRCReturnRC(autoCaller.rc());
130
130
 
131
131
    /** @todo */
132
132
    ReturnComNotImplemented();
140
140
 */
141
141
STDMETHODIMP MachineDebugger::COMSETTER(Singlestep) (BOOL aEnable)
142
142
{
143
 
    AutoCaller autoCaller (this);
144
 
    CheckComRCReturnRC (autoCaller.rc());
 
143
    AutoCaller autoCaller(this);
 
144
    CheckComRCReturnRC(autoCaller.rc());
145
145
 
146
146
    /** @todo */
147
147
    ReturnComNotImplemented();
157
157
{
158
158
    CheckComArgOutPointerValid(aEnabled);
159
159
 
160
 
    AutoCaller autoCaller (this);
161
 
    CheckComRCReturnRC (autoCaller.rc());
 
160
    AutoCaller autoCaller(this);
 
161
    CheckComRCReturnRC(autoCaller.rc());
162
162
 
163
 
    AutoReadLock alock (this);
 
163
    AutoReadLock alock(this);
164
164
 
165
165
    Console::SafeVMPtrQuiet pVM (mParent);
166
166
 
180
180
 */
181
181
STDMETHODIMP MachineDebugger::COMSETTER(RecompileUser) (BOOL aEnable)
182
182
{
183
 
    LogFlowThisFunc (("enable=%d\n", aEnable));
184
 
 
185
 
    AutoCaller autoCaller (this);
186
 
    CheckComRCReturnRC (autoCaller.rc());
187
 
 
188
 
    AutoWriteLock alock (this);
 
183
    LogFlowThisFunc(("enable=%d\n", aEnable));
 
184
 
 
185
    AutoCaller autoCaller(this);
 
186
    CheckComRCReturnRC(autoCaller.rc());
 
187
 
 
188
    AutoWriteLock alock(this);
189
189
 
190
190
    if (queueSettings())
191
191
    {
195
195
    }
196
196
 
197
197
    Console::SafeVMPtr pVM (mParent);
198
 
    CheckComRCReturnRC (pVM.rc());
 
198
    CheckComRCReturnRC(pVM.rc());
199
199
 
200
 
    PVMREQ pReq;
201
200
    EMRAWMODE rawModeFlag = aEnable ? EMRAW_RING3_DISABLE : EMRAW_RING3_ENABLE;
202
 
    int rcVBox = VMR3ReqCall (pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT,
203
 
                              (PFNRT)EMR3RawSetMode, 2, pVM.raw(), rawModeFlag);
204
 
    if (RT_SUCCESS (rcVBox))
205
 
    {
206
 
        rcVBox = pReq->iStatus;
207
 
        VMR3ReqFree (pReq);
208
 
    }
209
 
 
210
 
    if (RT_SUCCESS (rcVBox))
 
201
    int rcVBox = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)EMR3RawSetMode, 2, pVM.raw(), rawModeFlag);
 
202
    if (RT_SUCCESS(rcVBox))
211
203
        return S_OK;
212
204
 
213
205
    AssertMsgFailed (("Could not set raw mode flags to %d, rcVBox = %Rrc\n",
225
217
{
226
218
    CheckComArgOutPointerValid(aEnabled);
227
219
 
228
 
    AutoCaller autoCaller (this);
229
 
    CheckComRCReturnRC (autoCaller.rc());
 
220
    AutoCaller autoCaller(this);
 
221
    CheckComRCReturnRC(autoCaller.rc());
230
222
 
231
 
    AutoReadLock alock (this);
 
223
    AutoReadLock alock(this);
232
224
 
233
225
    Console::SafeVMPtrQuiet pVM (mParent);
234
226
 
248
240
 */
249
241
STDMETHODIMP MachineDebugger::COMSETTER(RecompileSupervisor) (BOOL aEnable)
250
242
{
251
 
    LogFlowThisFunc (("enable=%d\n", aEnable));
252
 
 
253
 
    AutoCaller autoCaller (this);
254
 
    CheckComRCReturnRC (autoCaller.rc());
255
 
 
256
 
    AutoWriteLock alock (this);
 
243
    LogFlowThisFunc(("enable=%d\n", aEnable));
 
244
 
 
245
    AutoCaller autoCaller(this);
 
246
    CheckComRCReturnRC(autoCaller.rc());
 
247
 
 
248
    AutoWriteLock alock(this);
257
249
 
258
250
    if (queueSettings())
259
251
    {
263
255
    }
264
256
 
265
257
    Console::SafeVMPtr pVM (mParent);
266
 
    CheckComRCReturnRC (pVM.rc());
 
258
    CheckComRCReturnRC(pVM.rc());
267
259
 
268
 
    PVMREQ pReq;
269
260
    EMRAWMODE rawModeFlag = aEnable ? EMRAW_RING0_DISABLE : EMRAW_RING0_ENABLE;
270
 
    int rcVBox = VMR3ReqCall (pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT,
271
 
                              (PFNRT)EMR3RawSetMode, 2, pVM.raw(), rawModeFlag);
272
 
    if (RT_SUCCESS (rcVBox))
273
 
    {
274
 
        rcVBox = pReq->iStatus;
275
 
        VMR3ReqFree (pReq);
276
 
    }
277
 
 
278
 
    if (RT_SUCCESS (rcVBox))
 
261
    int rcVBox = VMR3ReqCallWait(pVM, VMCPUID_ANY, (PFNRT)EMR3RawSetMode, 2, pVM.raw(), rawModeFlag);
 
262
    if (RT_SUCCESS(rcVBox))
279
263
        return S_OK;
280
264
 
281
265
    AssertMsgFailed (("Could not set raw mode flags to %d, rcVBox = %Rrc\n",
293
277
{
294
278
    CheckComArgOutPointerValid(aEnabled);
295
279
 
296
 
    AutoCaller autoCaller (this);
297
 
    CheckComRCReturnRC (autoCaller.rc());
 
280
    AutoCaller autoCaller(this);
 
281
    CheckComRCReturnRC(autoCaller.rc());
298
282
 
299
 
    AutoReadLock alock (this);
 
283
    AutoReadLock alock(this);
300
284
 
301
285
    Console::SafeVMPtrQuiet pVM (mParent);
302
286
 
316
300
 */
317
301
STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled) (BOOL aEnable)
318
302
{
319
 
    LogFlowThisFunc (("enable=%d\n", aEnable));
320
 
 
321
 
    AutoCaller autoCaller (this);
322
 
    CheckComRCReturnRC (autoCaller.rc());
323
 
 
324
 
    AutoWriteLock alock (this);
 
303
    LogFlowThisFunc(("enable=%d\n", aEnable));
 
304
 
 
305
    AutoCaller autoCaller(this);
 
306
    CheckComRCReturnRC(autoCaller.rc());
 
307
 
 
308
    AutoWriteLock alock(this);
325
309
 
326
310
    if (queueSettings())
327
311
    {
331
315
    }
332
316
 
333
317
    Console::SafeVMPtr pVM (mParent);
334
 
    CheckComRCReturnRC (pVM.rc());
 
318
    CheckComRCReturnRC(pVM.rc());
335
319
 
336
320
    PATMR3AllowPatching (pVM, aEnable);
337
321
 
348
332
{
349
333
    CheckComArgOutPointerValid(aEnabled);
350
334
 
351
 
    AutoCaller autoCaller (this);
352
 
    CheckComRCReturnRC (autoCaller.rc());
 
335
    AutoCaller autoCaller(this);
 
336
    CheckComRCReturnRC(autoCaller.rc());
353
337
 
354
 
    AutoReadLock alock (this);
 
338
    AutoReadLock alock(this);
355
339
 
356
340
    Console::SafeVMPtrQuiet pVM (mParent);
357
341
 
371
355
 */
372
356
STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled) (BOOL aEnable)
373
357
{
374
 
    LogFlowThisFunc (("enable=%d\n", aEnable));
375
 
 
376
 
    AutoCaller autoCaller (this);
377
 
    CheckComRCReturnRC (autoCaller.rc());
378
 
 
379
 
    AutoWriteLock alock (this);
 
358
    LogFlowThisFunc(("enable=%d\n", aEnable));
 
359
 
 
360
    AutoCaller autoCaller(this);
 
361
    CheckComRCReturnRC(autoCaller.rc());
 
362
 
 
363
    AutoWriteLock alock(this);
380
364
 
381
365
    if (queueSettings())
382
366
    {
386
370
    }
387
371
 
388
372
    Console::SafeVMPtr pVM (mParent);
389
 
    CheckComRCReturnRC (pVM.rc());
 
373
    CheckComRCReturnRC(pVM.rc());
390
374
 
391
375
    int vrc;
392
376
    if (aEnable)
394
378
    else
395
379
        vrc = CSAMDisableScanning (pVM);
396
380
 
397
 
    if (RT_FAILURE (vrc))
 
381
    if (RT_FAILURE(vrc))
398
382
    {
399
383
        /** @todo handle error case */
400
384
    }
412
396
{
413
397
    CheckComArgOutPointerValid(aEnabled);
414
398
 
415
 
    AutoCaller autoCaller (this);
416
 
    CheckComRCReturnRC (autoCaller.rc());
 
399
    AutoCaller autoCaller(this);
 
400
    CheckComRCReturnRC(autoCaller.rc());
417
401
 
418
402
#ifdef LOG_ENABLED
419
 
    AutoReadLock alock (this);
 
403
    AutoReadLock alock(this);
420
404
 
421
405
    const PRTLOGGER pLogInstance = RTLogDefaultInstance();
422
406
    *aEnabled = pLogInstance && !(pLogInstance->fFlags & RTLOGFLAGS_DISABLED);
435
419
 */
436
420
STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled) (BOOL aEnabled)
437
421
{
438
 
    LogFlowThisFunc (("aEnabled=%d\n", aEnabled));
439
 
 
440
 
    AutoCaller autoCaller (this);
441
 
    CheckComRCReturnRC (autoCaller.rc());
442
 
 
443
 
    AutoWriteLock alock (this);
 
422
    LogFlowThisFunc(("aEnabled=%d\n", aEnabled));
 
423
 
 
424
    AutoCaller autoCaller(this);
 
425
    CheckComRCReturnRC(autoCaller.rc());
 
426
 
 
427
    AutoWriteLock alock(this);
444
428
 
445
429
    if (queueSettings())
446
430
    {
450
434
    }
451
435
 
452
436
    Console::SafeVMPtr pVM (mParent);
453
 
    CheckComRCReturnRC (pVM.rc());
 
437
    CheckComRCReturnRC(pVM.rc());
454
438
 
455
439
#ifdef LOG_ENABLED
456
440
    int vrc = DBGFR3LogModifyFlags (pVM, aEnabled ? "enabled" : "disabled");
457
 
    if (RT_FAILURE (vrc))
 
441
    if (RT_FAILURE(vrc))
458
442
    {
459
443
        /** @todo handle error code. */
460
444
    }
473
457
{
474
458
    CheckComArgOutPointerValid(aEnabled);
475
459
 
476
 
    AutoCaller autoCaller (this);
477
 
    CheckComRCReturnRC (autoCaller.rc());
 
460
    AutoCaller autoCaller(this);
 
461
    CheckComRCReturnRC(autoCaller.rc());
478
462
 
479
 
    AutoReadLock alock (this);
 
463
    AutoReadLock alock(this);
480
464
 
481
465
    Console::SafeVMPtrQuiet pVM (mParent);
482
466
 
498
482
{
499
483
    CheckComArgOutPointerValid(aEnabled);
500
484
 
501
 
    AutoCaller autoCaller (this);
502
 
    CheckComRCReturnRC (autoCaller.rc());
 
485
    AutoCaller autoCaller(this);
 
486
    CheckComRCReturnRC(autoCaller.rc());
503
487
 
504
 
    AutoReadLock alock (this);
 
488
    AutoReadLock alock(this);
505
489
 
506
490
    Console::SafeVMPtrQuiet pVM (mParent);
507
491
 
523
507
{
524
508
    CheckComArgOutPointerValid(aEnabled);
525
509
 
526
 
    AutoCaller autoCaller (this);
527
 
    CheckComRCReturnRC (autoCaller.rc());
 
510
    AutoCaller autoCaller(this);
 
511
    CheckComRCReturnRC(autoCaller.rc());
528
512
 
529
 
    AutoReadLock alock (this);
 
513
    AutoReadLock alock(this);
530
514
 
531
515
    Console::SafeVMPtrQuiet pVM (mParent);
532
516
 
548
532
{
549
533
    CheckComArgOutPointerValid(aEnabled);
550
534
 
551
 
    AutoCaller autoCaller (this);
552
 
    CheckComRCReturnRC (autoCaller.rc());
 
535
    AutoCaller autoCaller(this);
 
536
    CheckComRCReturnRC(autoCaller.rc());
553
537
 
554
 
    AutoReadLock alock (this);
 
538
    AutoReadLock alock(this);
555
539
 
556
540
    Console::SafeVMPtrQuiet pVM (mParent);
557
541
 
576
560
{
577
561
    CheckComArgOutPointerValid(aPct);
578
562
 
579
 
    AutoCaller autoCaller (this);
580
 
    CheckComRCReturnRC (autoCaller.rc());
 
563
    AutoCaller autoCaller(this);
 
564
    CheckComRCReturnRC(autoCaller.rc());
581
565
 
582
 
    AutoReadLock alock (this);
 
566
    AutoReadLock alock(this);
583
567
 
584
568
    Console::SafeVMPtrQuiet pVM (mParent);
585
569
 
602
586
    if (aPct < 2 || aPct > 20000)
603
587
        return E_INVALIDARG;
604
588
 
605
 
    AutoCaller autoCaller (this);
606
 
    CheckComRCReturnRC (autoCaller.rc());
 
589
    AutoCaller autoCaller(this);
 
590
    CheckComRCReturnRC(autoCaller.rc());
607
591
 
608
 
    AutoWriteLock alock (this);
 
592
    AutoWriteLock alock(this);
609
593
 
610
594
    if (queueSettings())
611
595
    {
615
599
    }
616
600
 
617
601
    Console::SafeVMPtr pVM (mParent);
618
 
    CheckComRCReturnRC (pVM.rc());
 
602
    CheckComRCReturnRC(pVM.rc());
619
603
 
620
604
    int vrc = TMR3SetWarpDrive (pVM, aPct);
621
 
    if (RT_FAILURE (vrc))
 
605
    if (RT_FAILURE(vrc))
622
606
    {
623
607
        /** @todo handle error code. */
624
608
    }
639
623
{
640
624
    CheckComArgOutPointerValid(aVm);
641
625
 
642
 
    AutoCaller autoCaller (this);
643
 
    CheckComRCReturnRC (autoCaller.rc());
 
626
    AutoCaller autoCaller(this);
 
627
    CheckComRCReturnRC(autoCaller.rc());
644
628
 
645
 
    AutoReadLock alock (this);
 
629
    AutoReadLock alock(this);
646
630
 
647
631
    Console::SafeVMPtr pVM (mParent);
648
 
    CheckComRCReturnRC (pVM.rc());
 
632
    CheckComRCReturnRC(pVM.rc());
649
633
 
650
634
    *aVm = (uintptr_t)pVM.raw();
651
635
 
714
698
    char *pszSnapshot;
715
699
    int vrc = STAMR3Snapshot (pVM, Utf8Str (aPattern).raw(), &pszSnapshot, NULL,
716
700
                              !!aWithDescriptions);
717
 
    if (RT_FAILURE (vrc))
 
701
    if (RT_FAILURE(vrc))
718
702
        return vrc == VERR_NO_MEMORY ? E_OUTOFMEMORY : E_FAIL;
719
703
 
720
704
    /** @todo this is horribly inefficient! And it's kinda difficult to tell whether it failed...
721
705
     * Must use UTF-8 or ASCII here and completely avoid these two extra copy operations.
722
706
     * Until that's done, this method is kind of useless for debugger statistics GUI because
723
707
     * of the amount statistics in a debug build. */
724
 
    Bstr (pszSnapshot).cloneTo (aStats);
 
708
    Bstr (pszSnapshot).cloneTo(aStats);
725
709
 
726
710
    return S_OK;
727
711
}
734
718
 */
735
719
STDMETHODIMP MachineDebugger::InjectNMI()
736
720
{
737
 
    LogFlowThisFunc ((""));
738
 
 
739
 
    AutoCaller autoCaller (this);
740
 
    CheckComRCReturnRC (autoCaller.rc());
741
 
 
742
 
    AutoWriteLock alock (this);
 
721
    LogFlowThisFunc(("\n"));
 
722
 
 
723
    AutoCaller autoCaller(this);
 
724
    CheckComRCReturnRC(autoCaller.rc());
 
725
 
 
726
    AutoWriteLock alock(this);
743
727
 
744
728
    Console::SafeVMPtr pVM (mParent);
745
 
    CheckComRCReturnRC (pVM.rc());
 
729
    CheckComRCReturnRC(pVM.rc());
746
730
 
747
731
    HWACCMR3InjectNMI(pVM);
748
732
 
804
788
        // check if the machine is running
805
789
        MachineState_T machineState;
806
790
        mParent->COMGETTER(State) (&machineState);
807
 
        if (!Global::IsActive (machineState))
 
791
        switch (machineState)
 
792
        {
808
793
            // queue the request
809
 
            return true;
 
794
            default:
 
795
                return true;
 
796
 
 
797
            case MachineState_Running:
 
798
            case MachineState_Paused:
 
799
            case MachineState_Stuck:
 
800
            case MachineState_LiveSnapshotting:
 
801
            case MachineState_Teleporting:
 
802
                break;
 
803
        }
810
804
    }
811
805
    return false;
812
806
}