MasterGH Опубликовано 13 февраля, 2017 Поделиться Опубликовано 13 февраля, 2017 Рис.1 Вывод данных из двух окон трейслогов. Второе окно трейслога не показано на скриншоте Функции PrintTraceLog - просто вывод GetAddressTables - возвращает таблицу с int адресами *Делаем трейслоги. Запускаем скрипт. Выводятся адреса. Скрытый текст --Возвращает окна трейслога function GetTTreeViewTracelogs() local tracerWindows = {} local max = getFormCount() for i=0, max-1 do if(string.match(getForm(i).ClassName,'TfrmTracer')) then table.insert(tracerWindows, getForm(i).lvTracer) end end return tracerWindows end -- Вывоводит все адреса из трейслога function PrintTraceLog(treeView) local treeNodes = treeView.Items local count = treeNodes.getCount() local s = '' for i = 0, count-1 do local treeNode = treeNodes.getItem(i) s = s .. string.gsub(treeNode.Text, "(%S*)%s*%S*", "%1")..'\r\n' end print(s) end -- Записывает в таблицу integer адреса function GetAddressTables(treeView) local treeNodes = treeView.Items local count = treeNodes.getCount() local addresses = {} local s = '' for i = 0, count-1 do local treeNode = treeNodes.getItem(i) if(treeNode.Text ~= '') then s = string.gsub(treeNode.Text, "(%S*)%s*%S*", "%1") table.insert(addresses, getAddress(s)) end end return addresses end -- Получить все TreeView трейслогов tracerWindows = GetTTreeViewTracelogs() for i = 1, #tracerWindows do -- Получить таблицу адресов local tableAddresses = GetAddressTables(tracerWindows) for i = 1, #tableAddresses do -- Вывести по одному адресу print(tableAddresses) end end Внизу справка из main.lua Скрытый текст Treeview Class : (Inheritance: CustomControl->WinControl->Control->Component->Object) createTreeView(owner) properties Items: TreeNodes - The Treenodes object of the treeview (ReadOnly) Selected: TreeNode - The currently selected treenode methods beginUpdate() endUpdate() getItems() getSelected() setSelected() fullCollapse() : Collapses all the nodes, including the children's nodes fullExpand() : Expands all the nodes and all their children saveToFile(filename): Saves the contents of the treeview to disk --------------- TreeNodes class : (Inheritance: TObject) properties Count : Integer - The total number of Treenodes this object has Item[]: TreeNode - Array to access each node [] = Item[] methods clear() getCount() getItem(integer) : Return the TreeNode object at the given index (based on the TreeView's Treenodes) add(text:string): Returns a new root Treenode object insert(treenode, string): Returns a new treenode object that has been inserted before the given treenode insertBehind(treenode, string): Returns a new treenode object that has been inserted after the given treenode --------------- TreeNode class : (Inheritance: TObject) properties Text: string - The text of the treenode Parent: Treenode - The treenode this object is a child of. (can be nil) (ReadOnly) Level: Integer - The level this node is at HasChildren: boolean - Set to true if it has children, or you wish it to have an expand sign Expanded: boolean - Set to true if it has been expanded Count : Integer - The number of children this node has Items[]: Treenode - Array to access the child nodes of this node [] = Items[] Index: Integer - The index based on the parent AbsoluteIndex: Integer - The index based on the TreeView's Treenodes object (Items) Selected: Boolean - Set to true if currently selected MultiSelected: Boolean - Set to true if selected as well, but not the main selected object Data: Pointer - Space to store 4 or 8 bytes depending on which version of CE is used methods delete() deleteChildren() makeVisible() expand(recursive:boolean=TRUE OPTIONAL) : Expands the given node collapse(recursive:boolean=TRUE OPTIONAL) : collapses the given node getNextSibling(): Returns the treenode object that's behind this treenode on the same level add(text:string): Returns a Treenode object that is a child of the treenode used to create it 4 Ссылка на комментарий Поделиться на другие сайты Поделиться
Dino Опубликовано 14 февраля, 2017 Поделиться Опубликовано 14 февраля, 2017 Где это может понадобиться на практике? Ссылка на комментарий Поделиться на другие сайты Поделиться
partoftheworlD Опубликовано 14 февраля, 2017 Поделиться Опубликовано 14 февраля, 2017 Эх в иду бы подобный плагин, чтобы еще создавал один объеденный график, всех трассернутых инструкций. Ссылка на комментарий Поделиться на другие сайты Поделиться
MasterGH Опубликовано 14 февраля, 2017 Автор Поделиться Опубликовано 14 февраля, 2017 13 минуты назад, Dino сказал: Где это может понадобиться на практике? Даже не знаю как ответить. Для кого-то не пригодиться. А мне нужно для рисования ветвей кода. Видим путь, который код прошел и инструкции, которые не были пройдены. Если 4 трейслога, то 4 пути. Хотел показать как это выглядит, но сегодня не успел отладить, лезут ошибки. У меня 1 час ночи. Завтра на работу. Всем до завтра Ссылка на комментарий Поделиться на другие сайты Поделиться
MasterGH Опубликовано 15 февраля, 2017 Автор Поделиться Опубликовано 15 февраля, 2017 Исправил первый пост. Кусок кода ... -- Получить все TreeView трейслогов tracerWindows = GetTTreeViewTracelogs() for i = 1, #tracerWindows do -- Получить таблицу адресов local tableAddresses = GetAddressTables(tracerWindows[i]) for i = 1, #tableAddresses do -- Вывести по одному адресу print(tableAddresses[i]) end end ... 1 Ссылка на комментарий Поделиться на другие сайты Поделиться
Рекомендуемые сообщения