Bug #239 : Debugger 2.8.0.6: Ctrl-Print Screen while the debugger is active will copy the debugger text to the clipboard

This commit is contained in:
michaelangel007 2014-12-01 22:01:08 -08:00
parent 4102fd91f9
commit c2d6f5b026
5 changed files with 78 additions and 5 deletions

View File

@ -1,5 +1,6 @@
/*
.6 Added: Print-Screen when in debugger will copy the debugger window as text
.5 Added: Print warnings about duplicate symbols when symbol tables are loaded
.4 Fixed: Check for buffer overflow in CmdSymbolsInfo() if _CmdSymbolsInfoHeader() returns a very long string
.3 Removed EXITBENCH from falsely being triggered with E.

View File

@ -47,7 +47,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define ALLOW_INPUT_LOWERCASE 1
// See /docs/Debugger_Changelog.txt for full details
const int DEBUGGER_VERSION = MAKE_VERSION(2,8,0,5);
const int DEBUGGER_VERSION = MAKE_VERSION(2,8,0,6);
// Public _________________________________________________________________________________________
@ -4640,7 +4640,7 @@ Update_t CmdMemorySave (int nArgs)
#endif
char g_aTextScreen[ 24*82 + 1 ]; // (80 column + CR + LF) * 24 rows + NULL
char g_aTextScreen[ DEBUG_VIRTUAL_TEXT_HEIGHT * (DEBUG_VIRTUAL_TEXT_WIDTH + 4) ]; // (80 column + CR + LF) * 24 rows + NULL
int g_nTextScreen = 0;
/*
@ -4696,11 +4696,45 @@ static char RemapChar(const char c)
if ( c < 0x20 )
return c + '@'; // Remap INVERSE control character to NORMAL
else if ( c == 0x7F )
return ' '; // Remap checkboard (DEL) to space
return ' '; // Remap checkboard (DEL) to space
return c;
}
size_t Util_GetDebuggerText( char* &pText_ )
{
char *pBeg = &g_aTextScreen[0];
char *pEnd = &g_aTextScreen[0];
g_nTextScreen = 0;
memset( pBeg, 0, sizeof( g_aTextScreen ) );
memset( g_aDebuggerVirtualTextScreen, 0, sizeof( g_aDebuggerVirtualTextScreen ) );
DebugDisplay(1);
for( int y = 0; y < DEBUG_VIRTUAL_TEXT_HEIGHT; y++ )
{
for( int x = 0; x < DEBUG_VIRTUAL_TEXT_WIDTH; x++ )
{
char c = g_aDebuggerVirtualTextScreen[y][x];
if( (c < 0x20) || (c >= 0x7F) )
c = ' '; // convert null to spaces to keep everything non-proptional
*pEnd++ = c;
}
#ifdef _WIN32
*pEnd++ = 0x0D; // CR // Windows inserts extra char
#endif
*pEnd++ = 0x0A; // LF // OSX, Linux
}
*pEnd = 0;
g_nTextScreen = pEnd - pBeg;
pText_ = pBeg;
return g_nTextScreen;
}
size_t Util_GetTextScreen ( char* &pText_ )
{
WORD nAddressStart = 0;

View File

@ -61,6 +61,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// #define DISPLAY_BREAKPOINT_TITLE 1
// #define DISPLAY_WATCH_TITLE 1
// Public _________________________________________________________________________________________
// Font
@ -68,6 +69,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Private ________________________________________________________________________________________
char g_aDebuggerVirtualTextScreen[ DEBUG_VIRTUAL_TEXT_HEIGHT ][ DEBUG_VIRTUAL_TEXT_WIDTH ];
// HACK HACK HACK
//g_nDisasmWinHeight
@ -150,7 +152,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
const int DISPLAY_STACK_COLUMN = INFO_COL_1;
const int DISPLAY_TARGETS_COLUMN = INFO_COL_1;
const int DISPLAY_ZEROPAGE_COLUMN = INFO_COL_1;
const int DISPLAY_SOFTSWITCH_COLUMN = INFO_COL_1 - (CONSOLE_FONT_WIDTH/2) + 1;;
const int DISPLAY_SOFTSWITCH_COLUMN = INFO_COL_1 - (CONSOLE_FONT_WIDTH/2) + 1; // 1/2 char width padding around soft switches
// Horizontal Column (pixels) of BPs, Watches & Mem
const int INFO_COL_2 = (62 * 7); // nFontWidth
@ -617,6 +619,27 @@ void PrintGlyph( const int x, const int y, const char glyph )
int xSrc = (glyph & 0x0F) * CONSOLE_FONT_GRID_X;
int ySrc = (glyph >> 4) * CONSOLE_FONT_GRID_Y;
// BUG #239 - (Debugger) Save debugger "text screen" to clipboard / file
// if( g_bDebuggerVirtualTextCapture )
//
{
#if _DEBUG
if ((x < 0) || (y < 0))
MessageBox( g_hFrameWindow, "X or Y out of bounds!", "PrintGlyph()", MB_OK );
#endif
int col = x / CONSOLE_FONT_WIDTH ;
int row = y / CONSOLE_FONT_HEIGHT;
// if( !g_bDebuggerCopyInfoPane )
// if( col < 50
if (x > DISPLAY_DISASM_RIGHT) // INFO_COL_2 // DISPLAY_CPU_INFO_LEFT_COLUMN
col++;
if ((col < DEBUG_VIRTUAL_TEXT_WIDTH)
&& (row < DEBUG_VIRTUAL_TEXT_HEIGHT))
g_aDebuggerVirtualTextScreen[ row ][ col ] = glyph;
}
#if !DEBUG_FONT_NO_BACKGROUND_CHAR
// Background color
if (g_hConsoleBrushBG)

View File

@ -96,3 +96,12 @@
extern HDC GetDebuggerMemDC(void);
extern void ReleaseDebuggerMemDC(void);
extern void StretchBltMemToFrameDC(void);
enum DebugVirtualTextScreen_e
{
DEBUG_VIRTUAL_TEXT_WIDTH = 80,
DEBUG_VIRTUAL_TEXT_HEIGHT = 43
};
extern char g_aDebuggerVirtualTextScreen[ DEBUG_VIRTUAL_TEXT_HEIGHT ][ DEBUG_VIRTUAL_TEXT_WIDTH ];
extern size_t Util_GetDebuggerText( char* &pText_ ); // Same API as Util_GetTextScreen()

View File

@ -1102,7 +1102,13 @@ LRESULT CALLBACK FrameWndProc (
if (wparam == VK_SNAPSHOT_TEXT) // ( lparam & MOD_CONTROL )
{
char *pText;
size_t nSize = Util_GetTextScreen( pText );
size_t nSize = 0;
// if viewing the debugger, get the last virtual debugger screen
if ((g_nAppMode == MODE_DEBUG) && !g_bDebuggerViewingAppleOutput)
nSize = Util_GetDebuggerText( pText );
else
nSize = Util_GetTextScreen( pText );
Util_CopyTextToClipboard( nSize, pText );
}
break;