~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to lib/panic/panic.c

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2008-08-15 21:21:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080815212140-05fhxj8wroosysmj
Tags: 2008.08.08-109361-1ubuntu1
* Merge from Debian unstable (LP: #258393), remaining Ubuntu change:
  - add ubuntu_toolchain_FTBFS.dpatch patch, fix FTBFS
* Update ubuntu_toolchain_FTBFS.dpatch patch for the new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "str.h"
43
43
#include "config.h"
44
44
#include "util.h"
45
 
#ifdef _WIN32
 
45
#if defined(_WIN32) || !defined(VMX86_TOOLS)
46
46
#include "coreDump.h"
 
47
#endif
 
48
#ifdef _WIN32
47
49
#include "win32u.h"
48
50
#endif
49
51
 
50
 
 
51
52
typedef enum {
52
53
   PanicBreakLevel_Never,
53
54
   PanicBreakLevel_IfDebuggerAttached,
220
221
/*
221
222
 *-----------------------------------------------------------------------------
222
223
 *
 
224
 * Panic_SetCoreDumpFlags --
 
225
 *
 
226
 *      Although the core dump flags are read at init time, we may want to
 
227
 *      update this value later. This is especially true because the default
 
228
 *      value is read before the VM config is established.
 
229
 *
 
230
 * Results:
 
231
 *      None.
 
232
 *
 
233
 * Side effects:
 
234
 *      Updates global struct panicState.
 
235
 *
 
236
 *-----------------------------------------------------------------------------
 
237
 */
 
238
 
 
239
void
 
240
Panic_SetCoreDumpFlags(int flags)   // IN
 
241
{
 
242
   panicState.coreDumpFlags = flags;
 
243
}
 
244
 
 
245
 
 
246
/*
 
247
 *-----------------------------------------------------------------------------
 
248
 *
223
249
 * Panic_LoopOnPanic --
224
250
 *
225
251
 *    Loop until debugger intervention, if so configured.
422
448
 *      A nice default implementation that basic Panic can call if you don't
423
449
 *      want to write your own.  The VMX of course has its own.
424
450
 *
 
451
 *      TODO: Figure out how to trigger the Mac OS X Crash Reporter.
 
452
 *
425
453
 * Results:
426
454
 *      None.
427
455
 *
491
519
    * to double panic.
492
520
    */
493
521
 
494
 
#ifdef _WIN32
495
522
   Panic_DumpGuiResources();
496
523
 
497
 
   /*
498
 
    * XXX: Posix app coredumps have to wait until the coredump code makes
499
 
    * it out of lib/left/sigPosix and into lib/user/panic.
500
 
    */
 
524
#if defined(_WIN32) ||  !defined(VMX86_TOOLS)
501
525
   if (Panic_GetCoreDumpOnPanic()) {
502
526
      CoreDump_CoreDump();
503
527
   }
521
545
}
522
546
 
523
547
 
524
 
#ifdef _WIN32
525
548
/*
526
549
 *-----------------------------------------------------------------------------
527
550
 *
528
551
 * Panic_DumpGuiResources --
529
552
 *
530
 
 *      Dumps Win32 userlevel resources used by the current process.
531
 
 *      Dynamically loads user32!GetGuiResources because it's only
532
 
 *      implemented on Windows 2000 and later, while this module is
533
 
 *      linked by tools and possibly other things that need legacy
534
 
 *      Windows support.
 
553
 *      Dumps userlevel resources used by the current process.
535
554
 *
536
555
 * Results:
537
556
 *      void
545
564
void
546
565
Panic_DumpGuiResources(void)
547
566
{
 
567
#ifdef _WIN32
548
568
   HANDLE hUser = Win32U_GetModuleHandle("user32.dll");
549
569
   if (hUser) {
550
570
      typedef DWORD (WINAPI *fnGetGuiResources)(HANDLE, DWORD);
556
576
                 pGetGuiResources(GetCurrentProcess(), GR_USEROBJECTS));
557
577
      }
558
578
   }
 
579
#endif
559
580
}
560
 
#endif