diff options
author | Hans Bolinder <[email protected]> | 2013-02-22 15:09:25 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2013-03-07 13:54:33 +0100 |
commit | d0bb666c8811615981db8721c119ee6450857272 (patch) | |
tree | 8d9f67dfe26e61ff9a69e9a7f86eb302e1f1d7ab /lib/debugger/src/dbg_wx_mon_win.erl | |
parent | a8c7417e2e1b6e20c1f1a7247a04579b77ce9037 (diff) | |
download | otp-d0bb666c8811615981db8721c119ee6450857272.tar.gz otp-d0bb666c8811615981db8721c119ee6450857272.tar.bz2 otp-d0bb666c8811615981db8721c119ee6450857272.zip |
[debugger] Add an option 'Strings'
A new checkbox has been added. When it is checked, the range set by
the 'erl' flag '+pc' is used for determining when to print lists of
integers as strings. When it is unchecked, integer lists are never
printed as strings.
A minor incompatibility: settings saved by Erlang R16B01
or later cannot be read by Erlang R16B or earlier.
Diffstat (limited to 'lib/debugger/src/dbg_wx_mon_win.erl')
-rw-r--r-- | lib/debugger/src/dbg_wx_mon_win.erl | 72 |
1 files changed, 61 insertions, 11 deletions
diff --git a/lib/debugger/src/dbg_wx_mon_win.erl b/lib/debugger/src/dbg_wx_mon_win.erl index 04c3501b8c..a617f3e1e7 100644 --- a/lib/debugger/src/dbg_wx_mon_win.erl +++ b/lib/debugger/src/dbg_wx_mon_win.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2010. All Rights Reserved. +%% Copyright Ericsson AB 2008-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -36,6 +36,8 @@ -include_lib("wx/include/wx.hrl"). +-define(STRTEXT, "Use range of +pc flag"). + -define(default_rows,10). -record(moduleInfo, {module, menubtn}). @@ -60,6 +62,9 @@ ebutton, % gsobj() selected=[], % ['First Call'|'On Break'|'On Exit'] + %% Strings button(s) + stringsbutton,% gsobj() + slabel, % showing Stack Trace option blabel % showing Back Trace Size }). @@ -86,6 +91,10 @@ init() -> -define(W, 800). -define(H, 390). +%% FIXME +-define(autoId, 314). +-define(stringsId, 271). + create_win(_Wx, Title, Menus) -> wx:batch(fun() -> create_win_batch(Title, Menus) end). @@ -104,19 +113,19 @@ create_win_batch(Title, Menus) -> Hlb = 200, Listbox = wxListBox:new(Panel, ?wxID_ANY, [{size,{?Wf,Hlb}}, {style,?wxLB_SINGLE}]), - wxSizer:add(LeftSz,Listbox,[{proportion,1}, {border,3}]), + wxSizer:add(LeftSz,Listbox,[{proportion,1},{border,3},{flag,?wxEXPAND}]), wxListBox:connect(Listbox, command_listbox_doubleclicked), wxListBox:connect(Listbox, right_down), SBox = wxStaticBox:new(Panel, ?wxID_ANY, "Auto Attach:"), SBS = wxStaticBoxSizer:new(SBox, ?wxVERTICAL), - Fbtn = wxCheckBox:new(Panel, ?wxID_ANY, "First Call"), + Fbtn = wxCheckBox:new(Panel, ?autoId, "First Call"), wxSizer:add(SBS,Fbtn), - Bbtn = wxCheckBox:new(Panel, ?wxID_ANY, "On Break"), + Bbtn = wxCheckBox:new(Panel, ?autoId, "On Break"), wxSizer:add(SBS,Bbtn), - Ebtn = wxCheckBox:new(Panel, ?wxID_ANY, "On Exit"), + Ebtn = wxCheckBox:new(Panel, ?autoId, "On Exit"), wxSizer:add(SBS,Ebtn), - wxFrame:connect(Panel, command_checkbox_clicked), + wxFrame:connect(Panel, command_checkbox_clicked), wxSizer:add(LeftSz,SBS, [{flag,?wxEXPAND}]), SLabel = wxStaticText:new(Panel, ?wxID_ANY, "Stack Trace:\n On (with tail)"), @@ -124,6 +133,12 @@ create_win_batch(Title, Menus) -> BLabel = wxStaticText:new(Panel, ?wxID_ANY, "Back Trace Size:\n 50000"), wxSizer:add(LeftSz,BLabel), + StringsBox = wxStaticBox:new(Panel, ?wxID_ANY, "Strings:"), + StringsBS = wxStaticBoxSizer:new(StringsBox, ?wxVERTICAL), + Stringsbtn = wxCheckBox:new(Panel, ?stringsId, ?STRTEXT), + wxSizer:add(StringsBS,Stringsbtn), + wxSizer:add(LeftSz,StringsBS, [{flag,?wxEXPAND}]), + %% Create list_crtl / grid Grid = wxListCtrl:new(Panel, [{winid, ?GRID}, {style, ?wxLC_REPORT bor ?wxLC_SINGLE_SEL @@ -177,6 +192,7 @@ create_win_batch(Title, Menus) -> #winInfo{window=Win, grid=Grid, row=0, focus=0, listbox=Listbox, fbutton=Fbtn, bbutton=Bbtn, ebutton=Ebtn, + stringsbutton=Stringsbtn, slabel=SLabel, blabel=BLabel}. %%-------------------------------------------------------------------- @@ -190,11 +206,13 @@ get_window(WinInfo) -> %%-------------------------------------------------------------------- %% show_option(WinInfo, Option, Value) -> void() %% WinInfo = #winInfo{} -%% Option = auto_attach | stack_trace | back_trace +%% Option = auto_attach | stack_trace | back_trace | strings %% Value = [Flag] % Option==auto_attach %% Flag = init | break | exit %% | true | all | no_tail | false % Option==stack_trace -%% | int() % Option==back_trace +%% | integer() % Option==back_trace +%% | [SFlag] % Option==strings +%% SFlag = str_on %%-------------------------------------------------------------------- show_option(WinInfo, Option, Value) -> case Option of @@ -219,15 +237,28 @@ show_option(WinInfo, Option, Value) -> back_trace -> Text = "Back Trace Size:\n " ++ integer_to_list(Value), - wxStaticText:setLabel(WinInfo#winInfo.blabel, Text) + wxStaticText:setLabel(WinInfo#winInfo.blabel, Text); + strings -> + wx:foreach(fun(Button) -> + wxCheckBox:setValue(Button, false) + end, + option_buttons(WinInfo, [str_on])), + wx:foreach(fun(Button) -> + wxCheckBox:setValue(Button, true) + end, + option_buttons(WinInfo, Value)) end. +%% Auto Attach option_buttons(WinInfo, [init|Flags]) -> [WinInfo#winInfo.fbutton|option_buttons(WinInfo, Flags)]; option_buttons(WinInfo, [break|Flags]) -> [WinInfo#winInfo.bbutton|option_buttons(WinInfo, Flags)]; option_buttons(WinInfo, [exit|Flags]) -> [WinInfo#winInfo.ebutton|option_buttons(WinInfo, Flags)]; +%% Strings +option_buttons(WinInfo, [str_on|Flags]) -> + [WinInfo#winInfo.stringsbutton|option_buttons(WinInfo, Flags)]; option_buttons(_WinInfo, []) -> []. @@ -538,7 +569,8 @@ handle_event(#wx{obj=ListBox, event=#wxMouse{type=right_down, x=X,y=Y}}, end; %% Auto attach buttons -handle_event(#wx{event=#wxCommand{type=command_checkbox_clicked}}, +handle_event(#wx{id=?autoId, + event=#wxCommand{type=command_checkbox_clicked}}, WinInfo) -> Check = fun(Button, NamesAcc) -> case wxCheckBox:isChecked(Button) of @@ -555,6 +587,23 @@ handle_event(#wx{event=#wxCommand{type=command_checkbox_clicked}}, WinInfo#winInfo.fbutton]), {'Auto Attach', Names}; +%% Strings button(s) +handle_event(#wx{id=?stringsId, + event=#wxCommand{type=command_checkbox_clicked}}, + WinInfo) -> + Check = fun(Button, NamesAcc) -> + case wxCheckBox:isChecked(Button) of + true -> + Name = wxCheckBox:getLabel(Button), + [list_to_atom(Name)|NamesAcc]; + false -> + NamesAcc + end + end, + Names = wx:foldl(Check, [], + [WinInfo#winInfo.stringsbutton]), + {'Strings', Names}; + %% Process grid handle_event(#wx{event=#wxList{type=command_list_item_selected, itemIndex=Row}}, WinInfo) -> @@ -575,7 +624,8 @@ handle_event(#wx{userData=Data, _WinInfo) -> Data; handle_event(_Event, _WinInfo) -> -%% io:format("Ev: ~p~n",[_Event]), +%% FIXME + io:format("Ev: ~p~n",[_Event]), ignore. %%==================================================================== |