PRB: Can't Load Debugee with Multiple Data Segments

Last reviewed: July 22, 1997
Article ID: Q117793
1.00 1.50 WINDOWS kbtool kbprb

The information in this article applies to:

  • The Visual Workbench Integrated Debugger included with: Microsoft Visual C++ for Windows, versions 1.0 and 1.5

SYMPTOMS

When you attempt to debug a large-model Windows-based application in the debugger, the following error message displays:

   Could not load debuggee. Debuggee contains multiple writable data
   segments (16)

CAUSE

This error message occurs when you try to debug an application containing more than one data segment when another instance of the same application is already running. The problem is that 16-bit Windows does not allow more than one instance of an application containing multiple data segments to run. Furthermore, because Visual C++ runs in the 16-bit Windows-on-Windows (WOW) layer in Windows NT, the same error can occur there.

RESOLUTION

The easiest solution is to make sure that no instances of your program are running before you begin the debugging session.

If it is important to run multiple instances of your program, create a medium-memory model application or force all data near by using the /Gx and /Gt compile options.

NOTE: These options work only if the application's static data, string literals, stack, and heap all fit into one 64K segment.

The /Gx option causes the compiler to force static data into the default data segment, which results in the application having only one data segment (this is turned on by default in Visual C++).

The /Gt switch specifies the size that a static object must be to have its own data segment. When trying to create a single data segment, this threshold value should be large enough to ensure that no data objects are allocated outside of the default data segment. If the /Gt option is not specified, the data threshold will be 32767 bytes. You should only have to use this option if you have data structures that exceed 32767 bytes.

MORE INFORMATION

The reason that Windows does not allow more than one instance of an application containing multiple data segments to run is that the Windows loader cannot fix up multiple instances of far pointers because the code is shared among all instances of an application.

For more detailed information concerning multiple instances of large-model programs, see article Q90294, here in the Microsoft Knowledge Base.


Additional reference words: IDE 1.00 1.50 debuggee
KBCategory: kbtool kbprb
KBSubcategory: WBDebug
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.