--- ddd-3.3.12/ddd/ddd.C	2009-02-11 18:25:07.000000000 +0100
+++ ddd-3.3.12/ddd/ddd.C	2010-02-11 15:01:23.000000000 +0100
@@ -293,7 +293,12 @@ char ddd_rcsid[] =
 #if HAVE_EXCEPTIONS && HAVE_EXCEPTION
 #include <exception>
 #endif
-
+extern int Arch;
+extern int xmregs[];
+extern int mmregs[];
+extern int LastClicked;
+extern int XmmSet;
+extern int mmSet;
 #if WITH_READLINE
 extern "C" {
 #include "readline/readline.h"
@@ -339,6 +344,7 @@ static void gdbUpdateAllMenus();
 
 // Preferences
 static void make_preferences (Widget parent);
+static void make_regspref(Widget parent);
 static void dddPopupPreferencesCB (Widget, XtPointer, XtPointer);
 
 // Synchronize `():' fields
@@ -1232,6 +1238,68 @@ static MMDesc button_menu [] = 
     MMEnd
 };
 
+static Widget xmmDsply_w[8];
+static MMDesc register1_menu [] = 
+{
+	{"None",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(0)},0,&xmmDsply_w[0],0,0},
+	{"Float",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(1)},0,&xmmDsply_w[1],0,0},
+	{"Double",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(2)},0,&xmmDsply_w[2],0,0},
+	{"8 Bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(3)},0,&xmmDsply_w[3],0,0},
+	{"16 bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(4)},0,&xmmDsply_w[4],0,0},
+	{"32 bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(5)},0,&xmmDsply_w[5],0,0},
+	{"64 bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(6)},0,&xmmDsply_w[6],0,0},
+	{"128 bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(7)},0,&xmmDsply_w[7],0,0},
+ 	MMEnd
+};
+
+static Widget RegDisable_w[16];
+static MMDesc disableReg1_menu [] = 
+{
+	{"ax",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[0],0,0},
+	{"bx",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[1],0,0},
+	{"cx",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[2],0,0},
+	{"dx",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[3],0,0},
+	{"si",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[4],0,0},
+	{"di",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[5],0,0},
+	{"bp",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[6],0,0},
+	{"sp",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[7],0,0},
+	{"r8",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[8],0,0},
+	{"r9",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[9],0,0},
+	{"r10",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[10],0,0},
+	{"r11",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[11],0,0},
+	{"r12",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[12],0,0},
+	{"r13",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[13],0,0},
+	{"r14",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[14],0,0},
+	{"r15",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&RegDisable_w[15],0,0},
+ 	MMEnd
+};
+
+static Widget xRegDisable_w[8];
+static MMDesc xdisableReg1_menu [] = 
+{
+	{"ip",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[0],0,0},
+	{"flags",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[1],0,0},
+	{"cs",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[2],0,0},
+	{"ss",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[3],0,0},
+	{"ds",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[4],0,0},
+	{"es",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[5],0,0},
+	{"fs",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[6],0,0},
+	{"gs",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&xRegDisable_w[7],0,0},
+ 	MMEnd
+};
+
+static Widget mmDsply_w[6];
+static MMDesc register3_menu[] = 
+{
+	{"None",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&mmDsply_w[0],0,0},
+	{"FP Reg",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)}, 0,&mmDsply_w[1],0,0},
+	{"8 Bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)}, 0,&mmDsply_w[2],0,0},
+	{"16 bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&mmDsply_w[3],0,0},
+	{"32 bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&mmDsply_w[4],0,0},
+	{"64 bit",MMToggle,{dddToggleRegisterButtonsCB,XtPointer(True)},0,&mmDsply_w[5],0,0},
+   MMEnd
+};
+
 static Widget value_tips_w;
 static Widget value_docs_w;
 static MMDesc value_menu [] = 
@@ -1288,6 +1356,19 @@ static MMDesc general_preferences_menu[]
     MMEnd
 };
 
+static Widget PMMX_w;
+static Widget PXMM_w;
+static MMDesc register_preferenes_menu[] = 
+{
+   { "ALL MMX",MMPush,{dddToggleFPMMXButton,0},0,&PMMX_w,0,0},
+	{"MMX",MMRadioPanel,MMNoCB,register3_menu,0,0,0},
+   { "ALL XMM",MMPush,{dddToggleXMMButton,0},0,&PXMM_w,0,0},
+	{"XMM",MMRadioPanel,MMNoCB,register1_menu,0,0,0},
+	MMSep,
+	{"MASK",MMButtonPanel,MMNoCB,disableReg1_menu,0,0,0},
+	{"XMASK",MMButtonPanel,MMNoCB,xdisableReg1_menu,0,0,0},
+	MMEnd
+};
 
 // Source preferences
 static Widget set_display_glyphs_w;
@@ -3060,6 +3141,8 @@ ddd_exit_t pre_main_loop(int argc, char 
     // Create preference panels
     make_preferences(paned_work_w);
 
+	make_regspref(source_view->box);
+
     // Save option states
     save_option_state();
 
@@ -3152,6 +3235,11 @@ ddd_exit_t pre_main_loop(int argc, char 
 	    msg = msg.after('\n');
 	}
     }
+	if(gdb->type() == GDB)
+	{
+	string strn = "def vfdbl\ninf reg\nec \\nst0*\nou $st0\nec \\nst1*\nou $st1\nec \\nst2*\nou $st2\nec \\nst3*\nou $st3\nec \\nst4*\nou $st4\nec \\nst5*\nou $st5\nec \\nst6*\nou $st6\nec \\nst7*\nou $st7\nend\n";
+	gdb->write(strn);
+	}
     return DDD_CONTINUE;
 }
 
@@ -4088,6 +4176,9 @@ static bool have_cmd(const string& cmd)
 // Reflect state in option menus
 void update_options()
 {
+	Arch = -1;
+	if(gdb->type() == GDB)
+		source_view->refresh_registers_command();
     set_toggle(find_words_only_w, app_data.find_words_only);
     set_toggle(words_only_w, app_data.find_words_only);
 
@@ -4476,7 +4567,9 @@ static LayoutMode    initial_layout_mode
 static unsigned char initial_focus_policy;
 
 static Widget preferences_dialog;
+static Widget regspref_dialog;
 static Widget reset_preferences_w;
+static Widget reset_regprefs_w = NULL;
 static Widget current_panel;
 
 void save_option_state()
@@ -5210,6 +5303,167 @@ static void OfferRestartCB(Widget dialog
     }
 }
 
+void StartupRegisterSettings(void)
+{
+	manage_and_raise(regspref_dialog);
+	set_sensitive(reset_regprefs_w,false);
+	if(Arch == 0)
+	{
+		for(int i = 8;i < 16;i++)
+			XtUnmanageChild(RegDisable_w[i]);
+	}
+}
+
+void EndRegsDialog(void)
+{
+	XtUnmanageChild(regspref_dialog);
+}
+
+void RegSetChoise()
+{
+	int j;
+	if(LastClicked < 8)
+	{
+		if(!XmmSet)
+		{
+			for(j = 0;j < 16;j++)
+				xmregs[j] = LastClicked-1;
+		}
+		else
+			xmregs[XmmSet - 1] = LastClicked-1;
+	}
+	else if(LastClicked < 14)
+	{
+		if(!mmSet)
+		{
+			for(j = 0;j < 8;j++)
+				mmregs[j] = LastClicked-9;
+		}
+		else
+			mmregs[mmSet - 1] = LastClicked-9;
+	}
+}
+
+void ToggleRegisterButton(int buttonNo,int XmMm)
+{
+	if(XmMm)
+		XmToggleButtonSetState(xmmDsply_w[buttonNo],True,True);
+	else
+		XmToggleButtonSetState(mmDsply_w[buttonNo],True,True);
+}
+
+void SetCancelRegMod(bool isit)
+{
+	set_sensitive(reset_regprefs_w,isit);
+}
+
+void SizeRegsButton(int w,Dimension width,Dimension height,Dimension border_width)
+{
+	if(w & 1)
+		XtResizeWidget(PMMX_w,width,height,border_width);
+	if(w & 2)
+		XtResizeWidget(PXMM_w,width,height,border_width);
+}
+
+int CompareWidgt(Widget w)
+{
+	int i = -1;
+	int j,k;
+	for(j = 0;j < 8;j++)
+	{
+		if(w == xmmDsply_w[j])
+		{
+			i = j;
+			break;
+		}
+	}
+	if(i == -1)
+	{
+		for(k = 0;k < 6;k++,j++)
+		{
+			if(w == mmDsply_w[k])
+			{
+				i = j;
+				break;
+			}
+		}
+	}
+	if(i == -1)
+	{
+		for(k = 0;k < 16;k++,j++)
+		{
+			if(w == RegDisable_w[k])
+			{
+				i = j;
+				break;
+			}
+		}		
+	}
+	if(i == -1)
+	{
+		for(k = 0;k < 8;k++,j++)
+		{
+			if(w == xRegDisable_w[k])
+			{
+				i = j;
+				break;
+			}
+		}		
+	}
+	return i;
+}
+
+static void make_regspref(Widget parent)
+{
+	Arg args[4];
+	int arg;
+
+	regspref_dialog = verify(XmCreatePromptDialog(parent, 
+		XMST("registerpreferences"),args,0));
+	Delay::register_shell(regspref_dialog);
+	XtVaSetValues(regspref_dialog,XmNdefaultButton,Widget(0),XtPointer(0));
+	XtAddCallback(regspref_dialog,XmNunmapCallback,RegisterSettingsCB,
+		XtPointer(3));
+	if (lesstif_version <= 79)
+		XtUnmanageChild(XmSelectionBoxGetChild(regspref_dialog,
+			XmDIALOG_APPLY_BUTTON));
+	// Remove old prompt
+	XtUnmanageChild(XmSelectionBoxGetChild(regspref_dialog,XmDIALOG_TEXT));
+	XtUnmanageChild(XmSelectionBoxGetChild(regspref_dialog,
+		XmDIALOG_SELECTION_LABEL));
+	// Use cancel button to reset settings
+	reset_regprefs_w = XmSelectionBoxGetChild(regspref_dialog,
+		XmDIALOG_CANCEL_BUTTON);
+	XtRemoveAllCallbacks(reset_regprefs_w,XmNactivateCallback);
+	set_sensitive(reset_regprefs_w,false);
+	XtAddCallback(reset_regprefs_w,XmNactivateCallback,
+		ResetRegsPreferencesCB, XtPointer(2));
+	XtAddCallback(regspref_dialog,XmNhelpCallback,
+		      ImmediateHelpCB,XtPointer(regspref_dialog));
+ 	arg = 0;
+	XtSetArg(args[arg],XmNmarginWidth,0); arg++;
+	XtSetArg(args[arg],XmNmarginHeight,0); arg++;
+	XtSetArg(args[arg],XmNborderWidth,0); arg++;
+	Widget box = verify(XmCreateRowColumn(regspref_dialog,XMST("box"),
+		args,arg));
+ 	XtManageChild(box);
+	Widget frame = verify(XmCreateFrame(box,XMST("frame"),args,0));
+	XtManageChild(frame);
+	arg = 0;
+	XtSetArg(args[arg],XmNmarginWidth,0); arg++;
+	XtSetArg(args[arg],XmNmarginHeight,0); arg++;
+	XtSetArg(args[arg],XmNborderWidth,0); arg++;
+	Widget change = verify(XmCreateRowColumn(frame,XMST("change"),args,arg));
+	XtManageChild(change);
+	Dimension max_width  = 0;
+	Dimension max_height = 0;
+	Widget general_button = add_panel(change,box,"",
+		register_preferenes_menu,max_width,max_height,false);
+	XmToggleButtonSetState(xmmDsply_w[0],True,True);
+	XmToggleButtonSetState(mmDsply_w[0],True,True);
+	XtUnmanageChild(general_button);
+}
+
 // Create preferences dialog
 static void make_preferences(Widget parent)
 {
--- ddd-3.3.12/ddd/ddd.h	2009-02-11 18:25:06.000000000 +0100
+++ ddd-3.3.12/ddd/ddd.h	2009-06-24 18:59:32.000000000 +0200
@@ -111,5 +111,13 @@ extern void register_menu_shell(const MM
 // Process ^C key
 extern bool process_emergencies();
 
+extern void StartupRegisterSettings();
+extern int CompareWidgt(Widget w);
+extern void SetCancelRegMod(bool b);
+extern void EndRegsDialog();
+extern void ToggleRegisterButton(int buttonNo,int XmMm);
+extern void RegSetChoise(void);
+extern void	SizeRegsButton(int w,Dimension width,Dimension height,Dimension border_width);
+
 #endif // _DDD_ddd_h
 // DON'T ADD ANYTHING BEHIND THIS #endif
--- ddd-3.3.12/ddd/options.C	2009-02-11 18:25:06.000000000 +0100
+++ ddd-3.3.12/ddd/options.C	2010-02-11 13:50:20.000000000 +0100
@@ -116,6 +116,7 @@ extern "C" FILE *popen(const char *comma
 extern "C" int pclose(FILE *stream);
 #endif
 
+extern int	Arch;
 
 //-----------------------------------------------------------------------------
 // Helper Decls
@@ -128,6 +129,45 @@ extern "C" int pclose(FILE *stream);
 enum ChangeMode { ACKNOWLEDGE, ACCESS };
 static bool options_file_has_changed(ChangeMode mode, bool reset = false);
 
+bool RegsSaved = false;
+int	LastClicked = -1;
+int	XmmSet = 0;
+int	mmSet = 0;
+int	xmregs[16] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
+int	mmregs[8] = {-1,-1,-1,-1,-1,-1,-1,-1};
+int	Masked[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+int	saved_xmregs[16] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
+int	saved_mmregs[8] = {-1,-1,-1,-1,-1,-1,-1,-1};
+int	saved_Masked[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+const char vfdblStr[] = "def vfdbl\ninf reg\n";
+const char fltStr[] = "ec \\nst0*\nou $st0\nec \\nst1*\nou $st1\nec \\nst2*\nou $st2\nec \\nst3*\nou $st3\nec \\nst4*\nou $st4\nec \\nst5*\nou $st5\nec \\nst6*\nou $st6\nec \\nst7*\nou $st7\n";
+
+const char fltstat[] = "ec \\nfctrl*\nou/x $fctrl\nec \\nfstat*\nou/x $fstat\nec \\nftag*\nou/x $ftag\nec \\nfiseg*\nou/x $fiseg\nec \\nfioff*\nou/x $fioff\nec \\nfoseg*\nou/x $foseg\nec \\nfooff*\nou/x $fooff\nec \\nfop*\nou/x $fop\n";
+
+const char mmx8x[] = "ec \\nmm0*\nou $mm0.v8_int8\n";
+const char mmx16x[] = "ec \\nmm0*\nou $mm0.v4_int16\n";
+const char mmx32x[] = "ec \\nmm0*\nou $mm0.v2_int32\n";
+const char mmx64x[] = "ec \\nmm0*\nou $mm0.uint64\n";
+const char xmmfloat[] = "ec \\nxmm0*\nou $xmm0.v4_float\n";
+const char xmmfloat10[] = "ec \\nxmm10*\nou $xmm10.v4_float\n";
+const char xmmdouble[] = "ec \\nxmm0*\nou $xmm0.v2_double\n";
+const char xmmdouble10[] = "ec \\nxmm10*\nou $xmm10.v2_double\n";
+const char xmmint8[] = "ec \\nxmm0*\nou $xmm0.v16_int8\n";
+const char xmmint810[] = "ec \\nxmm10*\nou $xmm10.v16_int8\n";
+const char xmmint16[] = "ec \\nxmm0*\nou $xmm0.v8_int16\n";
+const char xmmint1610[] = "ec \\nxmm10*\nou $xmm10.v8_int16\n";
+const char xmmint32[] = "ec \\nxmm0*\nou $xmm0.v4_int32\n";
+const char xmmint3210[] = "ec \\nxmm10*\nou $xmm10.v4_int32\n";
+const char xmmint64[] = "ec \\nxmm0*\nou $xmm0.v2_int64\n";
+const char xmmint6410[] = "ec \\nxmm10*\nou $xmm10.v2_int64\n";
+const char xmmint128[] = "ec \\nxmm0*\nou $xmm0.uint128\n";
+const char xmmint12810[] = "ec \\nxmm10*\nou $xmm10.uint128\n";
+const char endit[] = "end\n";
+const char mxcsr[] = "ec \\nmxcsr*\nou $mxcsr\n";
+
+const char*	regStrPt[18] = {xmmfloat,xmmdouble,xmmint8,xmmint16,xmmint32,xmmint64,xmmint128,
+	xmmfloat10,xmmdouble10,xmmint810,xmmint1610,xmmint3210,xmmint6410,xmmint12810,
+	mmx8x,mmx16x,mmx32x,mmx64x};
 
 //-----------------------------------------------------------------------------
 // Source Options
@@ -257,6 +297,39 @@ void sourceSetAllRegistersCB (Widget, Xt
     update_options();
 }
 
+void sourceSetRegisterCB(Widget,XtPointer,XtPointer)
+{
+	StartupRegisterSettings();
+	Arch = -1;
+	source_view->refresh_registers_command();
+	SizeRegsButton(3,68,24,0);
+	SetCancelRegMod(false);
+	memcpy(saved_xmregs,xmregs,16*4);
+	memcpy(saved_mmregs,mmregs,8*4);
+	memcpy(saved_Masked,Masked,24*4);
+}
+
+void dddToggleRegisterButtonsCB(Widget awidgt,XtPointer, XtPointer call_data)
+{
+	XmToggleButtonCallbackStruct *info = (XmToggleButtonCallbackStruct *)call_data;
+	if(!RegsSaved)
+		RegsSaved = true;
+	SetCancelRegMod(true);
+	int i = CompareWidgt(awidgt);
+	if(info->set && i != -1)
+	{
+		if(i < 14)
+		{
+			LastClicked = i;
+			RegSetChoise();
+		}
+		else
+			Masked[i-14] = 1;
+	}
+	else if(i > 13)
+		Masked[i-14] = 0;
+}
+
 void sourceSetIntRegistersCB (Widget, XtPointer, XtPointer call_data)
 {
     XmToggleButtonCallbackStruct *info = 
@@ -268,9 +341,202 @@ void sourceSetIntRegistersCB (Widget, Xt
 	app_data.all_registers = false;
     }
 
+
     update_options();
 }
 
+void RegisterSettingsCB(Widget,XtPointer,XtPointer)
+{
+	if(RegsSaved)
+	{
+		char*	bldStr = new char[1024];
+		int i,k;
+		int j = 0;
+		int m = 16;
+		int xmregp = 0;
+		if(Arch == 0)
+			m = 8;
+		for(i = 0;i < m;i++)
+		{
+			if(xmregs[i] != -1)
+			{
+				xmregp = 1;
+				break;
+			}
+		}
+		for(i = 0;i < 8;i++)
+		{
+			if(mmregs[i] != -1)
+			{
+				xmregp |= 2;
+				break;
+			}
+		}
+		if(!xmregp)
+		{
+			source_view->RegisterDisplay = 0;
+			string s = "info registers";
+	   	source_view->process_registers(s);
+		}
+		else if(mmregs[0] == 0)
+		{
+			strcpy(bldStr,vfdblStr);
+			strcat(bldStr,fltStr);
+			if(Arch == 0)	
+				strcat(bldStr,fltstat);
+			if(xmregp & 1)
+			{
+				source_view->RegisterDisplay = 2;
+				for(i = 0;i < m;i++)
+				{
+					k = xmregs[i];
+					if(k != -1)
+					{
+						j = strlen(bldStr);
+						if(i<10)
+						{
+							strcat(bldStr,regStrPt[k]);
+							bldStr[j+8] = i + '0';			
+							bldStr[j+18] = i + '0';			
+						}
+						else
+						{
+							strcat(bldStr,regStrPt[k+7]);
+							bldStr[j+9] = i + '0' - 10;			
+							bldStr[j+20] = i + '0' - 10;			
+						}
+					}
+				}
+			}
+			else
+				source_view->RegisterDisplay = 1;
+			strcat(bldStr,endit);
+			gdb->write(bldStr,strlen(bldStr));
+		}
+		else
+		{
+			strcpy(bldStr,vfdblStr);
+			if(Arch == 0)
+				strcat(bldStr,mxcsr);
+			for(i = 0;i < m;i++)
+			{
+				k = xmregs[i];
+				if(k != -1)
+				{
+					j = strlen(bldStr);
+					if(i<10)
+					{
+						strcat(bldStr,regStrPt[k]);
+						bldStr[j+8] = i + '0';
+						bldStr[j+18] = i + '0';
+					}
+					else
+					{
+						strcat(bldStr,regStrPt[k+7]);
+						bldStr[j+9] = i + '0' - 10;
+						bldStr[j+20] = i + '0' - 10;
+					}
+				}
+			}
+			if(Arch == 0)
+			{
+				if(xmregp & 2 != 0)
+				{
+					for(i = 0;i < 8;i++)
+					{
+						k = mmregs[i];
+						if(k != -1)
+						{
+							j = strlen(bldStr);
+							strcat(bldStr,regStrPt[k+13]);
+							bldStr[j+7] = i + '0';
+							bldStr[j+16] = i + '0';
+						}
+					}
+				}
+				else
+				{
+					strcat(bldStr,fltStr);
+					strcat(bldStr,fltstat);
+				}
+			}
+			else if(mmregs[0] != -1)
+				strcat(bldStr,fltStr);
+			strcat(bldStr,endit);
+			gdb->write(bldStr,strlen(bldStr));
+ 		}
+		delete bldStr;
+	}
+}
+
+void ResetRegsPreferencesCB(Widget,XtPointer,XtPointer)
+{
+	memcpy(xmregs,saved_xmregs,16*4);
+	memcpy(mmregs,saved_mmregs,8*4);
+	memcpy(Masked,saved_Masked,24*4);
+	RegsSaved = false;
+	SetCancelRegMod(false);
+	EndRegsDialog();
+}
+
+void dddToggleFPMMXButton(Widget fpbutton,XtPointer,XtPointer)
+{
+	mmSet++;
+	if(mmSet == 9)
+		mmSet = 0;
+	char regst[8];
+	if(!mmSet)
+		strcpy(regst,"ALL MMX");
+	else
+	{
+		strcpy(regst,"MMX 0");
+		regst[4] = mmSet-1 + '0';
+		ToggleRegisterButton(mmregs[mmSet-1]+1,0);
+	}
+	Arg args[1];
+   XmString label_str = XmStringCreateLocalized(regst);
+   XtSetArg(args[0],XmNlabelString,label_str);      
+   XtSetValues(fpbutton,args,1);
+	SizeRegsButton(3,68,24,0);
+}
+
+void dddToggleXMMButton(Widget fxbutton,XtPointer,XtPointer)
+{
+	XmmSet++;
+	if(Arch)
+	{
+		if(XmmSet == 17)
+			XmmSet = 0;
+	}
+	else
+	{
+		if(XmmSet == 9)
+			XmmSet = 0;
+	}
+	char regst[8];
+	if(!XmmSet)
+		strcpy(regst,"ALL XMM");
+	else
+	{
+		if(XmmSet < 11)
+		{
+			strcpy(regst,"XMM 0 ");
+			regst[4] = XmmSet-1 + '0';
+		}
+		else
+		{
+			strcpy(regst,"XMM 10");
+			regst[5] = XmmSet-11 + '0';			
+		}
+		ToggleRegisterButton(xmregs[XmmSet-1]+1,1);		
+	}
+	Arg args[1];
+   XmString label_str = XmStringCreateLocalized(regst);
+   XtSetArg(args[0],XmNlabelString,label_str);      
+   XtSetValues(fxbutton,args,1);
+	SizeRegsButton(3,68,24,0);
+}
+
 void sourceSetTabWidthCB (Widget, XtPointer, XtPointer call_data)
 {
     XmScaleCallbackStruct *info = (XmScaleCallbackStruct *)call_data;
--- ddd-3.3.12/ddd/options.h	2009-02-11 18:25:06.000000000 +0100
+++ ddd-3.3.12/ddd/options.h	2009-06-24 22:07:59.000000000 +0200
@@ -66,6 +66,7 @@ bool get_restart_commands(string& restar
 void check_options_file();
 
 // Lots and lots of callbacks
+
 extern void sourceToggleFindWordsOnlyCB     (Widget, XtPointer, XtPointer);
 extern void sourceToggleFindCaseSensitiveCB (Widget, XtPointer, XtPointer);
 extern void sourceToggleCacheSourceFilesCB  (Widget, XtPointer, XtPointer);
@@ -78,7 +79,9 @@ extern void sourceSetUseSourcePathCB    
 extern void sourceSetTabWidthCB             (Widget, XtPointer, XtPointer);
 extern void sourceSetSourceIndentCB 	    (Widget, XtPointer, XtPointer);
 extern void sourceSetCodeIndentCB 	    (Widget, XtPointer, XtPointer);
-
+extern void	RegisterSettingsCB					(Widget, XtPointer, XtPointer);
+extern void ResetRegsPreferencesCB				(Widget, XtPointer, XtPointer);
+extern void sourceSetRegisterCB					(Widget,XtPointer,XtPointer);
 extern void graphToggleDetectAliasesCB      (Widget, XtPointer, XtPointer);
 extern void graphToggleAlign2dArraysCB      (Widget, XtPointer, XtPointer);
 extern void graphToggleShowGridCB           (Widget, XtPointer, XtPointer);
@@ -94,6 +97,9 @@ extern void graphSetGridSizeCB          
 extern void graphSetDisplayPlacementCB      (Widget, XtPointer, XtPointer);
 
 extern void dddToggleGroupIconifyCB         (Widget, XtPointer, XtPointer);
+extern void dddToggleRegisterButtonsCB			(Widget, XtPointer, XtPointer);
+extern void dddToggleFPMMXButton					(Widget, XtPointer, XtPointer);
+extern void dddToggleXMMButton					(Widget, XtPointer, XtPointer);
 extern void dddToggleUniconifyWhenReadyCB   (Widget, XtPointer, XtPointer);
 extern void dddToggleSeparateExecWindowCB   (Widget, XtPointer, XtPointer);
 extern void dddToggleCheckGrabsCB           (Widget, XtPointer, XtPointer);
--- ddd-3.3.12/ddd/SourceView.C	2009-02-11 18:25:06.000000000 +0100
+++ ddd-3.3.12/ddd/SourceView.C	2010-02-11 14:48:21.000000000 +0100
@@ -300,6 +300,26 @@ MMDesc SourceView::text_popup[] =
     MMEnd
 };
 
+string regsTxt[] = 
+{
+	"eax","ebx","ecx","edx","esi","edi","ebp","esp","xx","xx","xx","xx","xx","xx",
+	"xx","xx","eip","eflags","cs","ss","ds","es ","fs","gs"
+};
+
+string regsTxt64[] = 
+{
+	"rax","rbx","rcx","rdx","rsi","rdi","rbp","rsp","r8","r9","r10","r11","r12","r13",
+	"r14","r15","rip","eflags","cs","ss","ds","es","fs","gs"
+};
+
+extern int mmregs[];
+extern int xmregs[];
+extern int LastClicked;
+extern int XmmSet;
+extern int mmSet;
+extern int Masked[];
+int	Arch;
+bool FirstTime = false;
 
 //-----------------------------------------------------------------------
 // Glyphs and images
@@ -3447,6 +3467,8 @@ SourceView::SourceView(Widget parent)
     create_text(parent, "code", false, code_form_w, code_text_w);
     if (disassemble)
 	XtManageChild(code_form_w);
+	RegisterDisplay = 1;
+	Arch = -1;
 }
 
 void SourceView::create_shells()
@@ -3607,50 +3629,52 @@ void SourceView::create_shells()
     XtUnmanageChild(XmSelectionBoxGetChild(register_dialog_w, 
 					   XmDIALOG_CANCEL_BUTTON));
 
-    arg = 0;
-    Widget box = XmCreateRadioBox(register_dialog_w, XMST("box"), args, arg);
-    XtManageChild(box);
-
-    arg = 0;
-    XtSetArg(args[arg], XmNset, !all_registers); arg++;
-    int_registers_w = 
-	XmCreateToggleButton(box, XMST("int_registers"), args, arg);
-    XtManageChild(int_registers_w);
-
-    arg = 0;
-    XtSetArg(args[arg], XmNset, all_registers); arg++;
-    all_registers_w = 
-	XmCreateToggleButton(box, XMST("all_registers"), args, arg);
-    XtManageChild(all_registers_w);
-
-    XtAddCallback(int_registers_w, XmNvalueChangedCallback, 
-		  sourceSetIntRegistersCB, XtPointer(0));
-    XtAddCallback(all_registers_w, XmNvalueChangedCallback, 
-		  sourceSetAllRegistersCB, XtPointer(0));
-
-    arg = 0;
-    register_list_w = XmSelectionBoxGetChild(register_dialog_w, XmDIALOG_LIST);
-    XtVaSetValues(register_list_w,
-		  XmNselectionPolicy, XmSINGLE_SELECT,
-		  XtPointer(0));
-
-    XtAddCallback(register_list_w,
-		  XmNsingleSelectionCallback, SelectRegisterCB, 0);
-    XtAddCallback(register_list_w,
-		  XmNmultipleSelectionCallback, SelectRegisterCB, 0);
-    XtAddCallback(register_list_w,
-		  XmNextendedSelectionCallback, SelectRegisterCB, 0);
-    XtAddCallback(register_list_w,
-		  XmNbrowseSelectionCallback, SelectRegisterCB, 0);
-
-    XtAddCallback(register_dialog_w,
-		  XmNokCallback, UnmanageThisCB, register_dialog_w);
-    XtAddCallback(register_dialog_w,
-		  XmNokCallback, RegisterDialogPoppedDownCB, 0);
-    XtAddCallback(register_dialog_w,
-		  XmNhelpCallback, ImmediateHelpCB, 0);
-
-
+	arg = 0;
+  	box = XmCreateRadioBox(register_dialog_w,XMST("box"),args,arg);
+   XtManageChild(box);
+	if(gdb->type() == GDB)
+	{
+		Widget Rgst = XmCreatePushButton(box,XMST("Settings"),NULL,0);
+		XtManageChild(Rgst);
+		XtAddCallback(Rgst, XmNactivateCallback, 
+			sourceSetRegisterCB,XtPointer(0));
+		register_list_w = XmSelectionBoxGetChild(register_dialog_w, XmDIALOG_LIST);
+		XtVaSetValues(register_list_w,XmNselectionPolicy,XmSINGLE_SELECT,
+			XtPointer(0));
+		XtAddCallback(register_list_w,
+			XmNsingleSelectionCallback, SelectRegisterCB, 0);
+		XtAddCallback(register_dialog_w,
+			XmNokCallback, UnmanageThisCB, register_dialog_w);
+		XtAddCallback(register_dialog_w,
+			XmNhelpCallback, ImmediateHelpCB, 0);
+	}
+	else
+	{
+		arg = 0;
+		XtSetArg(args[arg], XmNset, !all_registers); arg++;
+		int_registers_w = 
+			XmCreateToggleButton(box, XMST("int_registers"), args, arg);
+		XtManageChild(int_registers_w);
+		arg = 0;
+		XtSetArg(args[arg], XmNset, all_registers); arg++;
+		all_registers_w = 
+		XmCreateToggleButton(box, XMST("all_registers"), args, arg);
+		XtManageChild(all_registers_w);
+		XtAddCallback(int_registers_w, XmNvalueChangedCallback, 
+			sourceSetIntRegistersCB, XtPointer(0));
+		XtAddCallback(all_registers_w, XmNvalueChangedCallback, 
+			sourceSetAllRegistersCB, XtPointer(0));
+		arg = 0;
+		register_list_w = XmSelectionBoxGetChild(register_dialog_w, XmDIALOG_LIST);
+		XtVaSetValues(register_list_w,XmNselectionPolicy,XmSINGLE_SELECT,XtPointer(0));
+		XtAddCallback(register_list_w,XmNsingleSelectionCallback,SelectRegisterCB,0);
+		XtAddCallback(register_list_w,XmNmultipleSelectionCallback, SelectRegisterCB, 0);
+		XtAddCallback(register_list_w,XmNextendedSelectionCallback, SelectRegisterCB, 0);
+		XtAddCallback(register_list_w,XmNbrowseSelectionCallback,SelectRegisterCB,0);
+		XtAddCallback(register_dialog_w,XmNokCallback,UnmanageThisCB,register_dialog_w);
+		XtAddCallback(register_dialog_w,XmNokCallback,RegisterDialogPoppedDownCB,0);
+		XtAddCallback(register_dialog_w,XmNhelpCallback,ImmediateHelpCB,0);
+	}
     // Create thread view
     arg = 0;
     XtSetArg(args[arg], XmNautoUnmanage, False); arg++;
@@ -7431,42 +7455,246 @@ bool SourceView::can_go_down()
 	(!where_required() || XtIsSensitive(down_w));
 }
 
-
 //-----------------------------------------------------------------------------
 // Register stuff
 //----------------------------------------------------------------------------
 
 void SourceView::process_registers(string& register_output)
 {
-    register_output.gsub(";\n", "\n");
-    register_output.gsub("; ", "\n");
-    register_output.gsub(";", "\n");
-    register_output.gsub("\n\n", "\n");
-
-    if (!register_output.contains("No ", 0))
-	undo_buffer.add_registers(register_output);
-
-    int count             = register_output.freq('\n') + 1;
-    string *register_list = new string[count];
-    bool *selected        = new bool[count];
-
-    split(register_output, register_list, count, '\n');
-
-    while (count > 0 && register_list[count - 1].empty())
-	count--;
-
-    for (int i = 0; i < count; i++)
-    {
-	tabto(register_list[i], 26);
-	untabify(register_list[i]);
-	selected[i] = false;
-    }
-
-    setLabelList(register_list_w, register_list, selected, count,
-		 false, false);
-
-    delete[] register_list;
-    delete[] selected;
+	register_output.gsub(";\n", "\n");
+	register_output.gsub("; ", "\n");
+	register_output.gsub(";", "\n");
+	register_output.gsub("\n\n", "\n");
+	if (!register_output.contains("No ", 0))
+		undo_buffer.add_registers(register_output);
+	int count             = register_output.freq('\n') + 1;
+	string *register_list = new string[count];
+	bool *selected        = new bool[count];
+	split(register_output, register_list, count, '\n');
+	if(FirstTime)
+	{
+		while (count > 0 && register_list[count - 1].empty())
+			count--;
+	}
+	else
+	{
+		FirstTime = true;
+		count = 16;
+		if(Arch)
+			count = 24;
+	}
+	int j,i;
+	string tstr;
+	if(gdb->type() == GDB)
+	{
+		for (i = 0; i < count; i++)
+		{
+			tabto(register_list[i], 26);
+			untabify(register_list[i]);
+			if(register_list[i].contains("0x") || register_list[i].contains(",")
+				||register_list[i].contains("*"))
+			{
+				if(register_list[i].contains("*"))
+				{
+					int fR0 = register_list[i].index("*",0);
+					switch(fR0)
+					{
+					case 3:
+						tstr = "      ";
+						break;
+					case 4:
+						tstr = "     ";
+						break;
+					case 5:
+						tstr = "    ";
+						break;
+					}
+					register_list[i] = register_list[i].at(0,fR0) + tstr +
+						register_list[i].at(fR0+1,register_list[i].length()-fR0-1);
+					if(fR0 == 3)
+					{
+						j = register_list[i][2] & 7;
+						if(mmregs[j] == -1)
+						{
+							for(j = i;j < count-1;j++)
+								register_list[j] = register_list[j+1];
+							count--;
+							i--;
+						}
+					}
+					if(register_list[i][0] == 'f' && mmregs[0] == -1)
+					{
+						for(j = i;j < count-1;j++)
+							register_list[j] = register_list[j+1];
+						count--;
+						i--;
+					}
+					if(register_list[i][0] == 'm'&& xmregs[0] == -1  && mmregs[0] == -1)
+					{
+						for(j = i;j < count-1;j++)
+							register_list[j] = register_list[j+1];
+						count--;
+						i--;
+					}
+				}
+				else
+				{
+				 	if((register_list[i][0] == 'f' && register_list[i][2] != ' ' &&
+						(mmregs[0] != 0 || mmregs[0] == -1)) ||
+						(register_list[i][0] == 'm' && register_list[i][1] == 'x' &&
+						xmregs[0] == -1))
+					{
+						for(j = i;j < count-1;j++)
+							register_list[j] = register_list[j+1];
+						count--;
+						i--;
+					}
+					else
+						register_list[i] = register_list[i].at(0,9)+
+							register_list[i].at(15,register_list[i].length()-15);
+				}
+				if(Arch == 1 && register_list[i].contains("st",0))
+				{ 
+					j = (int)register_list[i][register_list[i].index("st") + 2] & 7;
+					if( mmregs[j] != -1)
+						//hack - see below
+						register_list[i] = Gdb64MMXWorkaround(register_list[i]);
+					else
+					{
+						if(source_view->RegisterDisplay > 1)
+						{
+							for(j = i;j < count-1;j++)
+								register_list[j] = register_list[j+1];
+							count--;
+							i--;
+						}
+					}
+				}
+				for(int k = 0;k < 24;k++)
+				{
+					if(Masked[k])
+					{		
+						if(Arch == 0)
+							j = register_list[i].index(regsTxt[k]);
+						else
+							j = register_list[i].index(regsTxt64[k]);
+						if(j == 0)
+						{
+							for(j = i;j < count-1;j++)
+								register_list[j] = register_list[j+1];
+							count--;
+							i--;
+						}
+					}
+				}
+			}
+			selected[i] = false;
+		}
+	}
+	else
+	{
+	    for (i = 0; i < count; i++)
+   	 {
+			tabto(register_list[i], 26);
+			untabify(register_list[i]);
+			selected[i] = false;
+	    }
+	}
+	setLabelList(register_list_w, register_list, selected, count,
+		false, false);
+	delete[] register_list;
+	delete[] selected;
+}
+//Hack for gdb missing mmx registers in 64bit mode - hope gdb fixes this later
+string SourceView::Gdb64MMXWorkaround(string& transin)
+{
+	string transx = "mm0      (0x";
+	transx[2] = transin[2];
+	int k = transin.length();
+	int i = (int)transin[2] - '0';
+	if(transin.contains("nan"))
+	{
+		int j;
+		int m = 17;
+		string transtr;
+		for(j = k;transin[j-1] != 'x';j--)
+			m--;
+		for(;m > 0;m--)
+			transtr += "0";
+		for(;j < k-1;j++)
+			transtr += transin[j];
+		switch(mmregs[i])
+		{
+		case 1:
+        	i = 2;
+			for(j = 0;j < 16;j++)
+			{
+				if(i == j)
+				{
+					transx += ",0x";
+					i += 2;
+				}
+				transx += transtr[j];
+			}
+			transx += ")";
+			break;
+		case 2:
+			i = 4;
+			for(j = 0;j < 16;j++)
+			{
+				if(i == j)
+				{
+					transx += ",0x";
+					i += 4;
+				}
+				transx += transtr[j];
+			}
+			transx += ")";
+			break;
+		case 3:
+			i = 8;
+			for(j = 0;j < 16;j++)
+			{
+				if(i == j)
+				{
+					transx += ",0x";
+					i += 8;
+				}
+				transx += transtr[j];
+			}
+			transx += ")";
+			break;
+		case 4:
+			transx += transtr;
+			transx += ")";
+			break;
+		default:
+			transx = transin;
+			break;
+		}
+	}
+	else if(((k == 10 && transin[9] == '0') || transin.contains("-inf")) &&
+		mmregs[i] > 0 )
+	{
+		switch(mmregs[i])
+		{
+		case 1:				
+			transx += "00,0x00,0x00,0x00,0x00,0x00,0x00,0x00)";
+			break;
+		case 2:			
+			transx += "0000,0x0000,0x0000,0x0000)";
+			break;
+		case 3:
+			transx += "00000000,0x00000000)";
+			break;
+		case 4:
+			transx += "0000000000000000)";
+			break;
+		}
+	}
+	else
+		transx = transin;
+return transx;
 }
 
 void SourceView::refresh_registers()
@@ -7479,7 +7707,23 @@ void SourceView::refresh_registers()
 
 string SourceView::refresh_registers_command()
 {
-    return gdb->regs_command(all_registers);
+	if(gdb->type() != GDB)
+    	return gdb->regs_command(all_registers);	
+ 	if(Arch == -1)
+	{
+		string archtype = gdb_question("show architecture");
+		if(archtype.length() > 2)
+		{
+			if(archtype.contains("64"))
+				Arch = 1;
+			else
+				Arch = 0;
+		}
+	}
+	if(source_view->RegisterDisplay == 0)
+		return "info registers";
+	else
+		return "vfdbl";
 }
 
 void SourceView::ViewRegistersCB(Widget, XtPointer, XtPointer)
@@ -9853,12 +10097,10 @@ void SourceView::set_all_registers(bool 
 	    XmToggleButtonSetState(all_registers_w, (Boolean)set, False);
 	if (int_registers_w)
 	    XmToggleButtonSetState(int_registers_w, !(Boolean)set, False);
-
 	refresh_registers();
     }
 }
 
-
 // Some DBXes require `{ COMMAND; }', others `{ COMMAND }'.
 string SourceView::command_list(const string& cmd)
 {
@@ -9878,7 +10120,6 @@ string SourceView::bp_pos(int num)
 	return bp->pos();
 }
 
-
 // True iff we have some selection
 bool SourceView::have_selection()
 {
--- ddd-3.3.12/ddd/SourceView.h	2009-02-11 18:25:06.000000000 +0100
+++ ddd-3.3.12/ddd/SourceView.h	2009-06-24 22:21:34.000000000 +0200
@@ -166,7 +166,6 @@ class SourceView {
     // Clear breakpoint helpers
     static void clearBP(void *client_data, XtIntervalId *timer);
     static void clearJumpBP(const string& answer, void *client_data);
-
     // Move/Copy breakpoint NR to ADDRESS; return true if changed
     static bool move_bp(int nr, const string& address, Widget origin = 0,
 			bool copy = false);
@@ -293,6 +292,7 @@ class SourceView {
     static Widget register_list_w;            // Register list inside
     static Widget int_registers_w;            // Display integer registers
     static Widget all_registers_w;            // Display all registers
+//	 Widget set_registers_w;
     static bool register_dialog_popped_up;    // True if registers are visible
 
     static Widget thread_dialog_w;            // Dialog for threads
@@ -304,6 +304,7 @@ class SourceView {
     
     static bool disassemble;	              // Disassemble code?
     static bool all_registers;	              // Show all registers?
+//	 bool set_registers;
     static bool at_lowest_frame;              // Are we at lowest frame?
     static bool signal_received;	      // Did we receive a signal?
 
@@ -341,7 +342,6 @@ class SourceView {
     static StringStringAssoc file_cache;
     static StringOriginAssoc origin_cache;
     static CodeCache code_cache;
-
     // The current source text.
     static string current_source;
 
@@ -362,7 +362,6 @@ class SourceView {
 
     // File name of current source (for JDB)
     static StringStringAssoc file_name_cache;
-
     // Files listed as erroneous
     static StringArray bad_files;
     static bool new_bad_file(const string& file_name);
@@ -514,7 +513,8 @@ public:
 
     // Additional offset for multiple breakpoints (pixels)
     static Position multiple_stop_x_offset;
-
+	int	RegisterDisplay;
+	Widget box;
 private:
     // Glyph locations: X[0] is source, X[1] is code
     static Widget plain_arrows[2];
@@ -532,7 +532,8 @@ private:
     static Widget drag_conds[2];
     static Widget drag_temps[2];
 
-    // Return position POS of glyph GLYPH in X/Y.  Return true iff displayed.
+	 static string Gdb64MMXWorkaround(string& transtr);
+   // Return position POS of glyph GLYPH in X/Y.  Return true iff displayed.
     static bool glyph_pos_to_xy(Widget glyph, XmTextPosition pos,
 				Position& x, Position& y);
 
@@ -660,7 +661,7 @@ public:
     // Set frame manually to function FUNC; return True if found
     static bool set_frame_func(const string& func);
 
-    // Find S in current source; select it at TIME.
+    // Find S in current source; select it at TIME.RegisterDisplay
     enum SearchDirection {forward, backward};
 
     static void find(const string& s,
@@ -856,7 +857,7 @@ public:
     static void clear_file_cache();
     static void clear_code_cache();
 
-    // Get the line at POSITION
+    // Get the line at POSITIONregister_list[i]
     static string get_line(string position);
 
     // Get a help string for GLYPH; return 0 if none
