├── README.md ├── LICENSE ├── dw_processmemorymap.cpp ├── dw_processmoduleswidget.cpp ├── dw_processmemorymapwidget.cpp ├── xdebuggeroptionswidget.ui ├── dw_symbolswidget.cpp ├── dw_threadswidget.cpp ├── dw_processmoduleswidget.h ├── dw_processmemorymapwidget.h ├── dw_breakpointswidget.cpp ├── dw_processmemorymap.h ├── dw_hexview.h ├── dw_stackview.h ├── dw_symbolswidget.h ├── dw_threadswidget.h ├── dw_breakpointswidget.h ├── xdebuggeroptionswidget.h ├── dw_disasmview.h ├── xdebuggeroptionswidget.cpp ├── dw_registersview.h ├── xdebuggerloaddialog.h ├── dw_hexview.cpp ├── xdebuggerwidget.cmake ├── dw_stackview.cpp ├── xdebuggerwidget.pri ├── xdebuggerloaddialog.cpp ├── xdebuggerwidget.h ├── dw_registersview.cpp ├── xdebuggerloaddialog.ui ├── dw_disasmview.cpp ├── xdebuggerwidget.ui └── xdebuggerwidget.cpp /README.md: -------------------------------------------------------------------------------- 1 | # XDebuggerWidget 2 | 3 | Debugger widget 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021-2025 hors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /dw_processmemorymap.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2022 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_processmemorymap.h" 22 | 23 | DW_ProcessMemoryMap::DW_ProcessMemoryMap(QWidget *parent) : XProcessMemoryMapWidget(parent) 24 | { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dw_processmoduleswidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_processmoduleswidget.h" 22 | 23 | DW_ProcessModulesWidget::DW_ProcessModulesWidget(QWidget *pParent) : XProcessModulesWidget(pParent) 24 | { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dw_processmemorymapwidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_processmemorymapwidget.h" 22 | 23 | DW_ProcessMemoryMapWidget::DW_ProcessMemoryMapWidget(QWidget *pParent) : XProcessMemoryMapWidget(pParent) 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /xdebuggeroptionswidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | XDebuggerOptionsWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | true 33 | 34 | 35 | 36 | 37 | 0 38 | 0 39 | 398 40 | 298 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /dw_symbolswidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_symbolswidget.h" 22 | 23 | DW_SymbolsWidget::DW_SymbolsWidget(QWidget *pParent) : XSymbolsWidget(pParent) 24 | { 25 | } 26 | 27 | void DW_SymbolsWidget::contextMenu(const QPoint &pos) 28 | { 29 | Q_UNUSED(pos) 30 | } 31 | 32 | void DW_SymbolsWidget::registerShortcuts(bool bState) 33 | { 34 | Q_UNUSED(bState) 35 | } 36 | -------------------------------------------------------------------------------- /dw_threadswidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_threadswidget.h" 22 | 23 | DW_ThreadsWidget::DW_ThreadsWidget(QWidget *pParent) : XThreadsWidget(pParent) 24 | { 25 | } 26 | 27 | void DW_ThreadsWidget::contextMenu(const QPoint &pos) 28 | { 29 | Q_UNUSED(pos) 30 | } 31 | 32 | void DW_ThreadsWidget::registerShortcuts(bool bState) 33 | { 34 | Q_UNUSED(bState) 35 | } 36 | -------------------------------------------------------------------------------- /dw_processmoduleswidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_PROCESSMODULESWIDGET_H 22 | #define DW_PROCESSMODULESWIDGET_H 23 | 24 | #include "xprocessmoduleswidget.h" 25 | 26 | class DW_ProcessModulesWidget : public XProcessModulesWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit DW_ProcessModulesWidget(QWidget *pParent=nullptr); 32 | }; 33 | 34 | #endif // DW_PROCESSMODULESWIDGET_H 35 | -------------------------------------------------------------------------------- /dw_processmemorymapwidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_PROCESSMEMORYMAPWIDGET_H 22 | #define DW_PROCESSMEMORYMAPWIDGET_H 23 | 24 | #include "xprocessmemorymapwidget.h" 25 | 26 | class DW_ProcessMemoryMapWidget : public XProcessMemoryMapWidget { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DW_ProcessMemoryMapWidget(QWidget *pParent = nullptr); 31 | 32 | signals: 33 | }; 34 | 35 | #endif // DW_PROCESSMEMORYMAPWIDGET_H 36 | -------------------------------------------------------------------------------- /dw_breakpointswidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_breakpointswidget.h" 22 | 23 | DW_BreakPointsWidget::DW_BreakPointsWidget(QWidget *pParent) : XBreakPointsWidget(pParent) 24 | { 25 | } 26 | 27 | void DW_BreakPointsWidget::contextMenu(const QPoint &pos) 28 | { 29 | Q_UNUSED(pos) 30 | } 31 | 32 | void DW_BreakPointsWidget::registerShortcuts(bool bState) 33 | { 34 | Q_UNUSED(bState) 35 | } 36 | -------------------------------------------------------------------------------- /dw_processmemorymap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2022 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_PROCESSMEMORYMAP_H 22 | #define DW_PROCESSMEMORYMAP_H 23 | 24 | #include "xprocessmemorymapwidget.h" 25 | 26 | class DW_ProcessMemoryMap : public XProcessMemoryMapWidget 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit DW_ProcessMemoryMap(QWidget *parent = nullptr); 32 | 33 | signals: 34 | 35 | }; 36 | 37 | #endif // DW_PROCESSMEMORYMAP_H 38 | -------------------------------------------------------------------------------- /dw_hexview.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_HEXVIEW_H 22 | #define DW_HEXVIEW_H 23 | 24 | #include "xhexview.h" 25 | 26 | class DW_HexView : public XHexView { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DW_HexView(QWidget *pParent = nullptr); 31 | 32 | protected: 33 | virtual void contextMenu(const QPoint &pos); 34 | virtual void registerShortcuts(bool bState); 35 | }; 36 | 37 | #endif // DW_HEXVIEW_H 38 | -------------------------------------------------------------------------------- /dw_stackview.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_STACKVIEW_H 22 | #define DW_STACKVIEW_H 23 | 24 | #include "xstackview.h" 25 | 26 | class DW_StackView : public XStackView { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DW_StackView(QWidget *pParent = nullptr); 31 | 32 | protected: 33 | virtual void contextMenu(const QPoint &pos); 34 | virtual void registerShortcuts(bool bState); 35 | }; 36 | 37 | #endif // DW_STACKVIEW_H 38 | -------------------------------------------------------------------------------- /dw_symbolswidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_SYMBOLSWIDGET_H 22 | #define DW_SYMBOLSWIDGET_H 23 | 24 | #include "xsymbolswidget.h" 25 | 26 | class DW_SymbolsWidget : public XSymbolsWidget { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DW_SymbolsWidget(QWidget *pParent = nullptr); 31 | 32 | protected: 33 | virtual void contextMenu(const QPoint &pos); 34 | virtual void registerShortcuts(bool bState); 35 | }; 36 | 37 | #endif // DW_SYMBOLSWIDGET_H 38 | -------------------------------------------------------------------------------- /dw_threadswidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_THREADSWIDGET_H 22 | #define DW_THREADSWIDGET_H 23 | 24 | #include "xthreadswidget.h" 25 | 26 | class DW_ThreadsWidget : public XThreadsWidget { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DW_ThreadsWidget(QWidget *pParent = nullptr); 31 | 32 | protected: 33 | virtual void contextMenu(const QPoint &pos); 34 | virtual void registerShortcuts(bool bState); 35 | }; 36 | 37 | #endif // DW_THREADSWIDGET_H 38 | -------------------------------------------------------------------------------- /dw_breakpointswidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_BREAKPOINTSWIDGET_H 22 | #define DW_BREAKPOINTSWIDGET_H 23 | 24 | #include "xbreakpointswidget.h" 25 | 26 | class DW_BreakPointsWidget : public XBreakPointsWidget { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DW_BreakPointsWidget(QWidget *pParent = nullptr); 31 | 32 | protected: 33 | virtual void contextMenu(const QPoint &pos); 34 | virtual void registerShortcuts(bool bState); 35 | }; 36 | 37 | #endif // DW_BREAKPOINTSWIDGET_H 38 | -------------------------------------------------------------------------------- /xdebuggeroptionswidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef XDEBUGGEROPTIONSWIDGET_H 22 | #define XDEBUGGEROPTIONSWIDGET_H 23 | 24 | #include 25 | #include "xoptions.h" 26 | 27 | namespace Ui { 28 | class XDebuggerOptionsWidget; 29 | } 30 | 31 | class XDebuggerOptionsWidget : public QWidget { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit XDebuggerOptionsWidget(QWidget *pParent = nullptr); 36 | ~XDebuggerOptionsWidget(); 37 | 38 | void setOptions(XOptions *pOptions); 39 | 40 | static void setDefaultValues(XOptions *pOptions); 41 | 42 | public slots: 43 | void save(); 44 | void reload(); 45 | 46 | private: 47 | Ui::XDebuggerOptionsWidget *ui; 48 | XOptions *g_pOptions; 49 | }; 50 | 51 | #endif // XDEBUGGEROPTIONSWIDGET_H 52 | -------------------------------------------------------------------------------- /dw_disasmview.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_DISASMVIEW_H 22 | #define DW_DISASMVIEW_H 23 | 24 | #include "xdisasmview.h" 25 | 26 | class DW_DisasmView : public XDisasmView { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DW_DisasmView(QWidget *pParent = nullptr); 31 | 32 | public slots: 33 | void _breakpointToggle(); 34 | void _breakpointRemove(); 35 | void _breakpointConditional(); 36 | void _breakpointHardware0(); 37 | void _breakpointHardware1(); 38 | void _breakpointHardware2(); 39 | void _breakpointHardware3(); 40 | void _breakpointHardwareShow(); 41 | void _goToAddress(); 42 | 43 | protected: 44 | virtual void contextMenu(const QPoint &pos); 45 | virtual void registerShortcuts(bool bState); 46 | }; 47 | 48 | #endif // DW_DISASMVIEW_H 49 | -------------------------------------------------------------------------------- /xdebuggeroptionswidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "xdebuggeroptionswidget.h" 22 | #include "ui_xdebuggeroptionswidget.h" 23 | 24 | XDebuggerOptionsWidget::XDebuggerOptionsWidget(QWidget *pParent) : QWidget(pParent), ui(new Ui::XDebuggerOptionsWidget) 25 | { 26 | ui->setupUi(this); 27 | 28 | g_pOptions = nullptr; 29 | 30 | setProperty("GROUPID", XOptions::GROUPID_DEBUGGER); 31 | } 32 | 33 | XDebuggerOptionsWidget::~XDebuggerOptionsWidget() 34 | { 35 | delete ui; 36 | } 37 | 38 | void XDebuggerOptionsWidget::setOptions(XOptions *pOptions) 39 | { 40 | g_pOptions = pOptions; 41 | 42 | reload(); 43 | } 44 | 45 | void XDebuggerOptionsWidget::save() 46 | { 47 | } 48 | 49 | void XDebuggerOptionsWidget::setDefaultValues(XOptions *pOptions) 50 | { 51 | } 52 | 53 | void XDebuggerOptionsWidget::reload() 54 | { 55 | } 56 | -------------------------------------------------------------------------------- /dw_registersview.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef DW_REGISTERSVIEW_H 22 | #define DW_REGISTERSVIEW_H 23 | 24 | #include "xregistersview.h" 25 | 26 | class DW_RegistersView : public XRegistersView { 27 | Q_OBJECT 28 | 29 | enum SHORTCUT { 30 | SC_REGISTERS_EDIT, 31 | SC_REGISTERS_CLEAR, 32 | __SC_SIZE, 33 | // TODO more 34 | }; 35 | 36 | public: 37 | explicit DW_RegistersView(QWidget *pParent = nullptr); 38 | 39 | protected: 40 | virtual void contextMenu(const QPoint &pos); 41 | virtual void registerShortcuts(bool bState); 42 | 43 | private slots: 44 | void _followInDisasmSlot(); 45 | void _followInHexSlot(); 46 | 47 | signals: 48 | void followInHex(XADDR nAddress); 49 | void followInDisasm(XADDR nAddress); 50 | 51 | private: 52 | QShortcut *shortCuts[__SC_SIZE]; 53 | }; 54 | 55 | #endif // DW_REGISTERSVIEW_H 56 | -------------------------------------------------------------------------------- /xdebuggerloaddialog.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef XDEBUGGERLOADDIALOG_H 22 | #define XDEBUGGERLOADDIALOG_H 23 | 24 | #include 25 | #include "xabstractdebugger.h" 26 | 27 | namespace Ui { 28 | class XDebuggerLoadDialog; 29 | } 30 | 31 | class XDebuggerLoadDialog : public QDialog { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit XDebuggerLoadDialog(QWidget *pParent, XAbstractDebugger::OPTIONS *pOptions); 36 | ~XDebuggerLoadDialog(); 37 | 38 | private: 39 | void _setupCheckBox(QCheckBox *pCheckBox, XAbstractDebugger::OPTIONS_TYPE optionsStype); 40 | void _getCheckBoxValue(QCheckBox *pCheckBox, XAbstractDebugger::OPTIONS_TYPE optionsStype); 41 | 42 | private slots: 43 | void on_pushButtonCancel_clicked(); 44 | void on_pushButtonOK_clicked(); 45 | 46 | private: 47 | Ui::XDebuggerLoadDialog *ui; 48 | XAbstractDebugger::OPTIONS *g_pOptions; 49 | }; 50 | 51 | #endif // XDEBUGGERLOADDIALOG_H 52 | -------------------------------------------------------------------------------- /dw_hexview.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_hexview.h" 22 | 23 | DW_HexView::DW_HexView(QWidget *pParent) : XHexView(pParent) 24 | { 25 | // setAddressMode(MODE_ADDRESS); 26 | } 27 | 28 | void DW_HexView::contextMenu(const QPoint &pos) 29 | { 30 | if (isContextMenuEnable()) { 31 | if (getXInfoDB()) { 32 | QMenu contextMenu(this); 33 | 34 | // TODO more 35 | // Copy opcode 36 | QMenu menuGoTo(tr("Go to"), this); 37 | QMenu menuCopy(tr("Copy"), this); 38 | QMenu menuEdit(tr("Edit"), this); 39 | QMenu menuFollowIn(tr("Follow in"), this); 40 | 41 | QAction actionGoToAddress(tr("Address"), this); 42 | actionGoToAddress.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_HEX_GOTO_ADDRESS)); 43 | connect(&actionGoToAddress, SIGNAL(triggered()), this, SLOT(_goToAddressSlot())); 44 | 45 | menuGoTo.addAction(&actionGoToAddress); 46 | contextMenu.addMenu(&menuGoTo); 47 | 48 | QAction actionCopyAddress(tr("Address"), this); 49 | actionCopyAddress.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_HEX_COPY_ADDRESS)); 50 | connect(&actionCopyAddress, SIGNAL(triggered()), this, SLOT(_copyAddressSlot())); 51 | 52 | menuCopy.addAction(&actionCopyAddress); 53 | contextMenu.addMenu(&menuCopy); 54 | 55 | QAction actionEditHex(tr("Hex"), this); 56 | actionEditHex.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_HEX_EDIT_HEX)); 57 | connect(&actionEditHex, SIGNAL(triggered()), this, SLOT(_editHex())); 58 | 59 | menuEdit.addAction(&actionEditHex); 60 | contextMenu.addMenu(&menuEdit); 61 | 62 | QAction actionFollowInDisasm(tr("Disasm"), this); 63 | actionFollowInDisasm.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_HEX_FOLLOWIN_DISASM)); 64 | connect(&actionFollowInDisasm, SIGNAL(triggered()), this, SLOT(_followInDisasmSlot())); 65 | 66 | menuFollowIn.addAction(&actionFollowInDisasm); 67 | contextMenu.addMenu(&menuFollowIn); 68 | 69 | contextMenu.exec(pos); 70 | } 71 | } 72 | } 73 | 74 | void DW_HexView::registerShortcuts(bool bState) 75 | { 76 | Q_UNUSED(bState) 77 | 78 | // TODO 79 | } 80 | -------------------------------------------------------------------------------- /xdebuggerwidget.cmake: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_LIST_DIR}) 2 | 3 | 4 | if (NOT DEFINED XPECDEBUGGER_SOURCES) 5 | include(${CMAKE_CURRENT_LIST_DIR}/../XSpecDebugger/xspecdebugger.cmake) 6 | set(XDEBUGGERWIDGET_SOURCES ${XDEBUGGERWIDGET_SOURCES} ${XPECDEBUGGER_SOURCES}) 7 | endif() 8 | if (NOT DEFINED XPROCESSWIDGETADVANCED_SOURCES) 9 | include(${CMAKE_CURRENT_LIST_DIR}/../XProcessWidget/xprocesswidgetadvanced.cmake) 10 | set(XDEBUGGERWIDGET_SOURCES ${XDEBUGGERWIDGET_SOURCES} ${XPROCESSWIDGETADVANCED_SOURCES}) 11 | endif() 12 | 13 | include(${CMAKE_CURRENT_LIST_DIR}/../XDisasmView/xdisasmview.cmake) 14 | include(${CMAKE_CURRENT_LIST_DIR}/../XHexView/xhexview.cmake) 15 | include(${CMAKE_CURRENT_LIST_DIR}/../XRegistersView/xregistersview.cmake) 16 | include(${CMAKE_CURRENT_LIST_DIR}/../XStackView/xstackview.cmake) 17 | include(${CMAKE_CURRENT_LIST_DIR}/../XProcessMemoryMapWidget/xprocessmemorymapwidget.cmake) 18 | include(${CMAKE_CURRENT_LIST_DIR}/../XProcessModulesWidget/xprocessmoduleswidget.cmake) 19 | include(${CMAKE_CURRENT_LIST_DIR}/../XHandlesWidget/xhandleswidget.cmake) 20 | include(${CMAKE_CURRENT_LIST_DIR}/../XCallStackWidget/xcallstackwidget.cmake) 21 | include(${CMAKE_CURRENT_LIST_DIR}/../XSymbolsWidget/xsymbolswidget.cmake) 22 | include(${CMAKE_CURRENT_LIST_DIR}/../XRegionsWidget/xregionswidget.cmake) 23 | include(${CMAKE_CURRENT_LIST_DIR}/../XThreadsWidget/xthreadswidget.cmake) 24 | include(${CMAKE_CURRENT_LIST_DIR}/../XBreakPointsWidget/xbreakpointswidget.cmake) 25 | 26 | include(${CMAKE_CURRENT_LIST_DIR}/../XInfoDB/xinfodb.cmake) 27 | #include(${CMAKE_CURRENT_LIST_DIR}/../FormatWidgets/allformatwidgets.cmake) 28 | 29 | # ${XHANDLESWIDGET_SOURCES} 30 | # ${XCALLSTACKWIDGET_SOURCES} 31 | 32 | set(XDEBUGGERWIDGET_SOURCES 33 | ${XDEBUGGERWIDGET_SOURCES} 34 | ${XPECDEBUGGER_SOURCES} 35 | ${XBREAKPOINTSWIDGET_SOURCES} 36 | ${XDISASMVIEW_SOURCES} 37 | ${XHEXVIEW_SOURCES} 38 | ${XREGISTERSVIEW_SOURCES} 39 | ${XSTACKVIEW_SOURCES} 40 | ${XPROCESSMEMORYMAPWIDGET_SOURCES} 41 | ${XPROCESSMODULESWIDGET_SOURCES} 42 | ${XSYMBOLSWIDGET_SOURCES} 43 | ${XREGIONSWIDGET_SOURCES} 44 | ${XPROCESSWIDGETADVANCED_SOURCES} 45 | ${XINFODB_SOURCES} 46 | ${XTHREADSWIDGET_SOURCES} 47 | #${ALLFORMATWIDGETS_SOURCES} 48 | ${CMAKE_CURRENT_LIST_DIR}/dw_breakpointswidget.cpp 49 | ${CMAKE_CURRENT_LIST_DIR}/dw_breakpointswidget.h 50 | ${CMAKE_CURRENT_LIST_DIR}/dw_disasmview.cpp 51 | ${CMAKE_CURRENT_LIST_DIR}/dw_disasmview.h 52 | ${CMAKE_CURRENT_LIST_DIR}/dw_hexview.cpp 53 | ${CMAKE_CURRENT_LIST_DIR}/dw_hexview.h 54 | ${CMAKE_CURRENT_LIST_DIR}/dw_processmemorymapwidget.cpp 55 | ${CMAKE_CURRENT_LIST_DIR}/dw_processmemorymapwidget.h 56 | ${CMAKE_CURRENT_LIST_DIR}/dw_processmoduleswidget.cpp 57 | ${CMAKE_CURRENT_LIST_DIR}/dw_processmoduleswidget.h 58 | ${CMAKE_CURRENT_LIST_DIR}/dw_registersview.cpp 59 | ${CMAKE_CURRENT_LIST_DIR}/dw_registersview.h 60 | ${CMAKE_CURRENT_LIST_DIR}/dw_stackview.cpp 61 | ${CMAKE_CURRENT_LIST_DIR}/dw_stackview.h 62 | ${CMAKE_CURRENT_LIST_DIR}/dw_symbolswidget.cpp 63 | ${CMAKE_CURRENT_LIST_DIR}/dw_symbolswidget.h 64 | ${CMAKE_CURRENT_LIST_DIR}/dw_threadswidget.cpp 65 | ${CMAKE_CURRENT_LIST_DIR}/dw_threadswidget.h 66 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggerloaddialog.cpp 67 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggerloaddialog.h 68 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggerloaddialog.ui 69 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggeroptionswidget.cpp 70 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggeroptionswidget.h 71 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggeroptionswidget.ui 72 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggerwidget.cpp 73 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggerwidget.h 74 | ${CMAKE_CURRENT_LIST_DIR}/xdebuggerwidget.ui 75 | ) 76 | -------------------------------------------------------------------------------- /dw_stackview.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_stackview.h" 22 | 23 | DW_StackView::DW_StackView(QWidget *pParent) : XStackView(pParent) 24 | { 25 | } 26 | 27 | void DW_StackView::contextMenu(const QPoint &pos) 28 | { 29 | if (isContextMenuEnable()) { 30 | if (getXInfoDB()) { 31 | QMenu contextMenu(this); 32 | 33 | QMenu menuEdit(tr("Edit"), this); 34 | QMenu menuGoTo(tr("Go to"), this); 35 | QMenu menuCopy(tr("Copy"), this); 36 | QMenu menuFollowIn(tr("Follow in"), this); 37 | 38 | QAction actionGoToAddress(tr("Address"), this); 39 | actionGoToAddress.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_HEX_GOTO_ADDRESS)); 40 | connect(&actionGoToAddress, SIGNAL(triggered()), this, SLOT(_goToAddressSlot())); 41 | 42 | menuGoTo.addAction(&actionGoToAddress); 43 | contextMenu.addMenu(&menuGoTo); 44 | 45 | QAction actionCopyAddress(tr("Address"), this); 46 | actionCopyAddress.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_HEX_COPY_ADDRESS)); 47 | connect(&actionCopyAddress, SIGNAL(triggered()), this, SLOT(_copyAddressSlot())); 48 | 49 | menuCopy.addAction(&actionCopyAddress); 50 | contextMenu.addMenu(&menuCopy); 51 | 52 | QAction actionEditHex(tr("Hex"), this); 53 | actionEditHex.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_STACK_EDIT_HEX)); 54 | connect(&actionEditHex, SIGNAL(triggered()), this, SLOT(_editHex())); 55 | 56 | menuEdit.addAction(&actionEditHex); 57 | contextMenu.addMenu(&menuEdit); 58 | 59 | QAction actionFollowInHex(tr("Hex"), this); 60 | actionFollowInHex.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_STACK_FOLLOWIN_HEX)); 61 | connect(&actionFollowInHex, SIGNAL(triggered()), this, SLOT(_followInHexSlot())); 62 | 63 | QAction actionFollowInDisasm(tr("Disasm"), this); 64 | actionFollowInDisasm.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_STACK_FOLLOWIN_DISASM)); 65 | connect(&actionFollowInDisasm, SIGNAL(triggered()), this, SLOT(_followInDisasmSlot())); 66 | 67 | menuFollowIn.addAction(&actionFollowInHex); 68 | menuFollowIn.addAction(&actionFollowInDisasm); 69 | contextMenu.addMenu(&menuFollowIn); 70 | 71 | contextMenu.exec(pos); 72 | } 73 | } 74 | } 75 | 76 | void DW_StackView::registerShortcuts(bool bState) 77 | { 78 | Q_UNUSED(bState) 79 | } 80 | -------------------------------------------------------------------------------- /xdebuggerwidget.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += $$PWD 2 | DEPENDPATH += $$PWD 3 | 4 | DEFINES += USE_XPROCESS 5 | 6 | HEADERS += \ 7 | $$PWD/dw_breakpointswidget.h \ 8 | $$PWD/dw_disasmview.h \ 9 | $$PWD/dw_hexview.h \ 10 | $$PWD/dw_processmemorymapwidget.h \ 11 | $$PWD/dw_processmoduleswidget.h \ 12 | $$PWD/dw_registersview.h \ 13 | $$PWD/dw_stackview.h \ 14 | $$PWD/dw_symbolswidget.h \ 15 | $$PWD/dw_threadswidget.h \ 16 | $$PWD/xdebuggerloaddialog.h \ 17 | $$PWD/xdebuggeroptionswidget.h \ 18 | $$PWD/xdebuggerwidget.h 19 | 20 | SOURCES += \ 21 | $$PWD/dw_breakpointswidget.cpp \ 22 | $$PWD/dw_disasmview.cpp \ 23 | $$PWD/dw_hexview.cpp \ 24 | $$PWD/dw_processmemorymapwidget.cpp \ 25 | $$PWD/dw_processmoduleswidget.cpp \ 26 | $$PWD/dw_registersview.cpp \ 27 | $$PWD/dw_stackview.cpp \ 28 | $$PWD/dw_symbolswidget.cpp \ 29 | $$PWD/dw_threadswidget.cpp \ 30 | $$PWD/xdebuggerloaddialog.cpp \ 31 | $$PWD/xdebuggeroptionswidget.cpp \ 32 | $$PWD/xdebuggerwidget.cpp 33 | 34 | FORMS += \ 35 | $$PWD/xdebuggerloaddialog.ui \ 36 | $$PWD/xdebuggeroptionswidget.ui \ 37 | $$PWD/xdebuggerwidget.ui 38 | 39 | !contains(XCONFIG, xspecdebugger) { 40 | XCONFIG += xspecdebugger 41 | include($$PWD/../XSpecDebugger/xspecdebugger.pri) 42 | } 43 | 44 | !contains(XCONFIG, xdisasmview) { 45 | XCONFIG += xdisasmview 46 | include($$PWD/../XDisasmView/xdisasmview.pri) 47 | } 48 | 49 | !contains(XCONFIG, xhexview) { 50 | XCONFIG += xhexview 51 | include($$PWD/../XHexView/xhexview.pri) 52 | } 53 | 54 | !contains(XCONFIG, xregistersview) { 55 | XCONFIG += xregistersview 56 | include($$PWD/../XRegistersView/xregistersview.pri) 57 | } 58 | 59 | !contains(XCONFIG, xstackview) { 60 | XCONFIG += xstackview 61 | include($$PWD/../XStackView/xstackview.pri) 62 | } 63 | 64 | #!contains(XCONFIG, xdebugscript) { 65 | # XCONFIG += xdebugscript 66 | # include($$PWD/../XDebugScript/xdebugscript.pri) 67 | #} 68 | 69 | !contains(XCONFIG, xprocessmemorymapwidget) { 70 | XCONFIG += xprocessmemorymapwidget 71 | include($$PWD/../XProcessMemoryMapWidget/xprocessmemorymapwidget.pri) 72 | } 73 | 74 | !contains(XCONFIG, xprocessmoduleswidget) { 75 | XCONFIG += xprocessmoduleswidget 76 | include($$PWD/../XProcessModulesWidget/xprocessmoduleswidget.pri) 77 | } 78 | 79 | !contains(XCONFIG, xhandleswidget) { 80 | XCONFIG += xhandleswidget 81 | include($$PWD/../XHandlesWidget/xhandleswidget.pri) 82 | } 83 | 84 | !contains(XCONFIG, xcallstackwidget) { 85 | XCONFIG += xcallstackwidget 86 | include($$PWD/../XCallStackWidget/xcallstackwidget.pri) 87 | } 88 | 89 | !contains(XCONFIG, xsymbolswidget) { 90 | XCONFIG += xsymbolswidget 91 | include($$PWD/../XSymbolsWidget/xsymbolswidget.pri) 92 | } 93 | 94 | !contains(XCONFIG, xthreadswidget) { 95 | XCONFIG += xthreadswidget 96 | include($$PWD/../XThreadsWidget/xthreadswidget.pri) 97 | } 98 | 99 | !contains(XCONFIG, xbreakpointswidget) { 100 | XCONFIG += xbreakpointswidget 101 | include($$PWD/../XBreakPointsWidget/xbreakpointswidget.pri) 102 | } 103 | 104 | !contains(XCONFIG, xprocesswidgetadvanced) { 105 | XCONFIG += xprocesswidgetadvanced 106 | include($$PWD/../XProcessWidget/xprocesswidgetadvanced.pri) 107 | } 108 | 109 | !contains(XCONFIG, xinfodb) { 110 | XCONFIG += xinfodb 111 | include($$PWD/../XInfoDB/xinfodb.pri) 112 | } 113 | 114 | !contains(XCONFIG, allformatwidgets) { 115 | XCONFIG += allformatwidgets 116 | include($$PWD/../FormatWidgets/allformatwidgets.pri) 117 | } 118 | 119 | #TODO callstack 120 | 121 | DISTFILES += \ 122 | $$PWD/LICENSE \ 123 | $$PWD/README.md 124 | -------------------------------------------------------------------------------- /xdebuggerloaddialog.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "xdebuggerloaddialog.h" 22 | #include "ui_xdebuggerloaddialog.h" 23 | 24 | XDebuggerLoadDialog::XDebuggerLoadDialog(QWidget *pParent, XAbstractDebugger::OPTIONS *pOptions) : QDialog(pParent), ui(new Ui::XDebuggerLoadDialog) 25 | { 26 | ui->setupUi(this); 27 | 28 | g_pOptions = pOptions; 29 | 30 | ui->lineEditFilename->setText(pOptions->sFileName); 31 | ui->lineEditArguments->setText(pOptions->sArguments); 32 | ui->lineEditDirectory->setText(pOptions->sDirectory); 33 | 34 | _setupCheckBox(ui->checkBoxShowConsole, XAbstractDebugger::OPTIONS_TYPE_SHOWCONSOLE); 35 | _setupCheckBox(ui->checkBoxChangePermissions, XAbstractDebugger::OPTIONS_TYPE_CHANGEPERMISSIONS); 36 | _setupCheckBox(ui->checkBoxBreakpointDLLMain, XAbstractDebugger::OPTIONS_TYPE_BREAKPOINTDLLMAIN); 37 | _setupCheckBox(ui->checkBoxBreakpointEntryPoint, XAbstractDebugger::OPTIONS_TYPE_BREAKPOINTENTRYPOINT); 38 | _setupCheckBox(ui->checkBoxBreakpointExceptions, XAbstractDebugger::OPTIONS_TYPE_BREAKPONTEXCEPTIONS); 39 | _setupCheckBox(ui->checkBoxBreakpointSystem, XAbstractDebugger::OPTIONS_TYPE_BREAKPONTSYSTEM); 40 | _setupCheckBox(ui->checkBoxBreakpointTLSFunctions, XAbstractDebugger::OPTIONS_TYPE_BREAKPOINTTLSFUNCTION); 41 | } 42 | 43 | XDebuggerLoadDialog::~XDebuggerLoadDialog() 44 | { 45 | delete ui; 46 | } 47 | 48 | void XDebuggerLoadDialog::_setupCheckBox(QCheckBox *pCheckBox, XAbstractDebugger::OPTIONS_TYPE optionsStype) 49 | { 50 | if (g_pOptions->records[optionsStype].bValid) { 51 | pCheckBox->show(); 52 | pCheckBox->setChecked(g_pOptions->records[optionsStype].varValue.toBool()); 53 | } else { 54 | pCheckBox->hide(); 55 | } 56 | } 57 | 58 | void XDebuggerLoadDialog::_getCheckBoxValue(QCheckBox *pCheckBox, XAbstractDebugger::OPTIONS_TYPE optionsStype) 59 | { 60 | if (g_pOptions->records[optionsStype].bValid) { 61 | pCheckBox->setChecked(g_pOptions->records[optionsStype].varValue.toBool()); 62 | g_pOptions->records[optionsStype].varValue = pCheckBox->isChecked(); 63 | } 64 | } 65 | 66 | void XDebuggerLoadDialog::on_pushButtonCancel_clicked() 67 | { 68 | reject(); 69 | } 70 | 71 | void XDebuggerLoadDialog::on_pushButtonOK_clicked() 72 | { 73 | g_pOptions->sFileName = ui->lineEditFilename->text(); 74 | g_pOptions->sArguments = ui->lineEditArguments->text(); 75 | g_pOptions->sDirectory = ui->lineEditDirectory->text(); 76 | _getCheckBoxValue(ui->checkBoxShowConsole, XAbstractDebugger::OPTIONS_TYPE_SHOWCONSOLE); 77 | _getCheckBoxValue(ui->checkBoxBreakpointDLLMain, XAbstractDebugger::OPTIONS_TYPE_BREAKPOINTDLLMAIN); 78 | _getCheckBoxValue(ui->checkBoxBreakpointEntryPoint, XAbstractDebugger::OPTIONS_TYPE_BREAKPOINTENTRYPOINT); 79 | _getCheckBoxValue(ui->checkBoxBreakpointExceptions, XAbstractDebugger::OPTIONS_TYPE_BREAKPONTEXCEPTIONS); 80 | _getCheckBoxValue(ui->checkBoxBreakpointSystem, XAbstractDebugger::OPTIONS_TYPE_BREAKPONTSYSTEM); 81 | _getCheckBoxValue(ui->checkBoxBreakpointTLSFunctions, XAbstractDebugger::OPTIONS_TYPE_BREAKPOINTTLSFUNCTION); 82 | 83 | accept(); 84 | } 85 | -------------------------------------------------------------------------------- /xdebuggerwidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #ifndef XDEBUGGERWIDGET_H 22 | #define XDEBUGGERWIDGET_H 23 | 24 | #include 25 | #ifdef Q_OS_WIN 26 | #include "xwindowsdebugger.h" 27 | #endif 28 | #ifdef Q_OS_LINUX 29 | #include "xlinuxdebugger.h" 30 | #endif 31 | #ifdef Q_OS_MACOS 32 | #include "xosxdebugger.h" 33 | #endif 34 | #include "xdebuggerconsole.h" 35 | #include "xshortcutswidget.h" 36 | #include "xinfodb.h" 37 | #include "xdebuggerloaddialog.h" 38 | 39 | // TODO WinAPI page/ Widget 40 | // TODO for Linux send signal to process widget/menu 41 | // TODO Dialog on open Command line/ symbols 42 | 43 | namespace Ui { 44 | class XDebuggerWidget; 45 | } 46 | 47 | class XDebuggerWidget : public XShortcutsWidget { 48 | Q_OBJECT 49 | 50 | enum MT { 51 | MT_CPU = 0, 52 | MT_LOG, 53 | MT_BREAKPOINTS, 54 | MT_MEMORYMAP, 55 | MT_CALLSTACK, 56 | MT_THREADS, 57 | MT_HANDLES, 58 | MT_MODULES, 59 | MT_SYMBOLS 60 | }; 61 | 62 | enum SHORTCUT { 63 | SC_DISASM_BREAKPOINTTOGGLE, 64 | SC_DISASM_BREAKPOINTCONDITIONAL, 65 | SC_DISASM_BREAKPOINTREMOVE, 66 | __SC_SIZE, 67 | // TODO more 68 | }; 69 | 70 | enum CM { 71 | CM_UNKNOWN = 0, 72 | CM_READY, 73 | CM_DEBUG_RUN, 74 | CM_DEBUG_CLOSE, 75 | CM_DEBUG_STEPINTO, 76 | CM_DEBUG_STEPOVER, 77 | CM_ANIMATE_STEPINTO, 78 | CM_ANIMATE_STEPOVER, 79 | CM_ANIMATE_STOP, 80 | CM_TRACE_STEPINTO, 81 | CM_TRACE_STEPOVER, 82 | CM_TRACE_STOP 83 | }; 84 | 85 | public: 86 | // TODO 87 | // TODO stateChanged -> update menus 88 | struct STATE { 89 | bool bAnimateStepInto; 90 | bool bAnimateStepOver; 91 | bool bAnimateStop; 92 | bool bTraceStepInto; 93 | bool bTraceStepOver; 94 | bool bTraceStop; 95 | }; 96 | 97 | explicit XDebuggerWidget(QWidget *pParent = nullptr); 98 | ~XDebuggerWidget(); 99 | 100 | bool loadFile(const QString &sFileName, bool bShowLoadDialog); 101 | void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions); 102 | virtual void adjustView(); 103 | virtual void reloadShortcuts(); 104 | STATE getState(); 105 | 106 | signals: 107 | void errorMessage(const QString &sErrorMessage); 108 | void infoMessage(const QString &sInfoMessage); 109 | void warningMessage(const QString &sWarningMessage); 110 | void resetWidgetsSignal(); 111 | void stateChanged(); 112 | void testSignal(X_ID nThreadId); // TODO remove 113 | void addSymbols(QString sFileName, XADDR nImageBase); 114 | void removeSymbols(QString sFileName); 115 | // void debugStepOverSignal(); 116 | 117 | public slots: 118 | bool debugRun(); 119 | bool debugClose(); 120 | bool debugStepInto(); 121 | bool debugStepOver(); 122 | bool animateStepInto(); 123 | bool animateStepOver(); 124 | bool animateStop(); 125 | bool traceStepInto(); 126 | bool traceStepOver(); 127 | bool traceStop(); 128 | bool command(XDebuggerWidget::CM commandMode); 129 | void viewCPU(); 130 | void viewLog(); 131 | void viewBreakpoints(); 132 | void viewMemoryMap(); 133 | void viewCallstack(); 134 | void viewThreads(); 135 | void viewHandles(); 136 | void viewModules(); 137 | void viewSymbols(); 138 | 139 | private: 140 | void _stateChanged(); 141 | void _adjustState(); 142 | void _clearProcessMemory(); 143 | XProcess *_getProcessMemory(XADDR nAddress, qint64 nSize); 144 | 145 | private slots: 146 | void onCreateProcess(XInfoDB::PROCESS_INFO *pProcessInfo); 147 | void onBreakPoint(XInfoDB::BREAKPOINT_INFO *pBreakPointInfo); 148 | void onExitProcess(XInfoDB::EXITPROCESS_INFO *pExitProcessInfo); 149 | void eventCreateThread(XInfoDB::THREAD_INFO *pThreadInfo); 150 | void eventExitThread(XInfoDB::EXITTHREAD_INFO *pExitThreadInfo); 151 | void eventLoadSharedObject(XInfoDB::SHAREDOBJECT_INFO *pSharedObjectInfo); 152 | void eventUnloadSharedObject(XInfoDB::SHAREDOBJECT_INFO *pSharedObjectInfo); 153 | void onReloadSignal(); // TODO Check remove 154 | void on_toolButtonRun_clicked(); 155 | void on_toolButtonStepInto_clicked(); 156 | void on_toolButtonStepOver_clicked(); 157 | void _breakpointToggle(); 158 | void _breakpointRemove(); 159 | void _breakpointConditional(); 160 | void cleanUp(); 161 | void resetWidgets(); 162 | void errorMessageSlot(const QString &sErrorMessage); 163 | void infoMessageSlot(const QString &sInfoMessage); 164 | void warningMessageSlot(const QString &sInfoMessage); 165 | void writeToLog(const QString &sText); 166 | void on_tabWidgetMain_currentChanged(int nIndex); 167 | void reload(); 168 | void followInDisasm(XADDR nAddress); 169 | void followInHex(XADDR nAddress); 170 | void followInStack(XADDR nAddress); 171 | void on_toolButtonAnimateStepInto_clicked(); 172 | void on_toolButtonAnimateStepOver_clicked(); 173 | void on_toolButtonAnimateStop_clicked(); 174 | void on_toolButtonTraceStepInto_clicked(); 175 | void on_toolButtonTraceStepOver_clicked(); 176 | void on_toolButtonTraceStop_clicked(); 177 | // void memoryRegionsListChangedSlot(); 178 | void modulesListChangedSlot(); 179 | void threadsListChangedSlot(); 180 | void registersListChangedSlot(); 181 | void updateWidget(MT mt); 182 | void on_pushButtonCommandRun_clicked(); 183 | void addSymbolsSlot(const QString &FileName, XADDR nImageBase); 184 | void removeSymbolsSlot(const QString &sFileName); 185 | 186 | protected: 187 | virtual void registerShortcuts(bool bState); 188 | 189 | private: 190 | Ui::XDebuggerWidget *ui; 191 | #ifdef Q_OS_WIN 192 | QThread *g_pThread; 193 | XWindowsDebugger *g_pDebugger; 194 | #endif 195 | #ifdef Q_OS_LINUX 196 | XLinuxDebugger *g_pDebugger; 197 | #endif 198 | #ifdef Q_OS_MACOS 199 | XOSXDebugger *g_pDebugger; 200 | #endif 201 | XInfoDB *g_pInfoDB; 202 | XInfoDB::BREAKPOINT_INFO g_currentBreakPointInfo; 203 | QShortcut *shortCuts[__SC_SIZE]; 204 | // XBinary::OSINFO g_osInfo; 205 | QList g_listRegions; 206 | 207 | XProcess::MEMORY_REGION g_mrDisasm; 208 | XProcess::MEMORY_REGION g_mrStack; 209 | XProcess::MEMORY_REGION g_mrHex; 210 | 211 | STATE g_state; 212 | QTimer *g_pTimer; 213 | QMutex *g_pMutex; 214 | }; 215 | 216 | #endif // XDEBUGGERWIDGET_H 217 | -------------------------------------------------------------------------------- /dw_registersview.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_registersview.h" 22 | 23 | DW_RegistersView::DW_RegistersView(QWidget *pParent) : XRegistersView(pParent) 24 | { 25 | memset(shortCuts, 0, sizeof shortCuts); 26 | } 27 | 28 | void DW_RegistersView::contextMenu(const QPoint &pos) 29 | { 30 | QMenu contextMenu(this); 31 | 32 | QAction actionCopy(tr("Copy"), this); 33 | actionCopy.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_REGISTERS_COPY)); 34 | connect(&actionCopy, SIGNAL(triggered()), this, SLOT(_actionCopy())); 35 | contextMenu.addAction(&actionCopy); 36 | QAction actionEdit(tr("Edit"), this); 37 | QAction actionClear(tr("Clear"), this); 38 | QMenu menuFollowIn(tr("Follow in"), this); 39 | QAction actionFollowInDisasm(tr("Disasm"), this); 40 | QAction actionFollowInHex(tr("Hex"), this); 41 | 42 | qint32 nIndex = -1; 43 | XInfoDB::XREG reg = pointToReg(pos, &nIndex); 44 | 45 | if (nIndex != -1) { 46 | if (isClearEnable(reg)) { 47 | actionEdit.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_REGISTERS_EDIT)); 48 | connect(&actionEdit, SIGNAL(triggered()), this, SLOT(_actionEdit())); 49 | contextMenu.addAction(&actionEdit); 50 | } 51 | 52 | if (isClearEnable(reg)) { 53 | actionClear.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_REGISTERS_CLEAR)); 54 | connect(&actionClear, SIGNAL(triggered()), this, SLOT(_actionClear())); 55 | contextMenu.addAction(&actionClear); 56 | } 57 | 58 | #ifdef Q_PROCESSOR_X86_32 59 | XADDR nAddress = getXinfoDB()->getCurrentRegCache(reg).var.toLongLong(); 60 | #endif 61 | #ifdef Q_PROCESSOR_X86_64 62 | XADDR nAddress = getXinfoDB()->getCurrentRegCache(reg).var.toLongLong(); 63 | #endif 64 | if (getXinfoDB()->isAddressValid(nAddress)) { 65 | actionFollowInDisasm.setProperty("ADDRESS", nAddress); 66 | actionFollowInDisasm.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_REGISTERS_FOLLOWIN_DISASM)); 67 | connect(&actionFollowInDisasm, SIGNAL(triggered()), this, SLOT(_followInDisasmSlot())); 68 | 69 | actionFollowInHex.setProperty("ADDRESS", nAddress); 70 | actionFollowInHex.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_REGISTERS_FOLLOWIN_HEX)); 71 | connect(&actionFollowInHex, SIGNAL(triggered()), this, SLOT(_followInHexSlot())); 72 | 73 | menuFollowIn.addAction(&actionFollowInDisasm); 74 | menuFollowIn.addAction(&actionFollowInHex); 75 | contextMenu.addMenu(&menuFollowIn); 76 | } 77 | 78 | // TODO Follow in stack if address 79 | // TODO Copy value 80 | // TODO Set to 1 81 | // TODO invert 82 | // TODO increment 83 | // TODO decrement 84 | contextMenu.addSeparator(); 85 | } 86 | 87 | QMenu menuView(tr("View"), this); 88 | 89 | QAction actionGeneral(QString("General"), this); 90 | actionGeneral.setCheckable(true); 91 | actionGeneral.setChecked(getOptions().bGeneral); 92 | connect(&actionGeneral, SIGNAL(triggered()), this, SLOT(_actionViewGeneral())); 93 | menuView.addAction(&actionGeneral); 94 | 95 | QAction actionIP(QString("IP"), this); 96 | actionIP.setCheckable(true); 97 | actionIP.setChecked(getOptions().bIP); 98 | connect(&actionIP, SIGNAL(triggered()), this, SLOT(_actionViewIP())); 99 | menuView.addAction(&actionIP); 100 | 101 | #ifdef Q_PROCESSOR_X86 102 | QAction actionFlags(QString("Flags"), this); 103 | actionFlags.setCheckable(true); 104 | actionFlags.setChecked(getOptions().bFlags); 105 | connect(&actionFlags, SIGNAL(triggered()), this, SLOT(_actionViewFlags())); 106 | menuView.addAction(&actionFlags); 107 | 108 | QAction actionSegments(QString("Segments"), this); 109 | actionSegments.setCheckable(true); 110 | actionSegments.setChecked(getOptions().bSegments); 111 | connect(&actionSegments, SIGNAL(triggered()), this, SLOT(_actionViewSegments())); 112 | menuView.addAction(&actionSegments); 113 | 114 | QAction actionDebug(QString("Debug"), this); 115 | actionDebug.setCheckable(true); 116 | actionDebug.setChecked(getOptions().bDebug); 117 | connect(&actionDebug, SIGNAL(triggered()), this, SLOT(_actionViewDebug())); 118 | menuView.addAction(&actionDebug); 119 | 120 | QAction actionFloat(QString("Float"), this); 121 | actionFloat.setCheckable(true); 122 | actionFloat.setChecked(getOptions().bFloat); 123 | connect(&actionFloat, SIGNAL(triggered()), this, SLOT(_actionViewFloat())); 124 | menuView.addAction(&actionFloat); 125 | 126 | QAction actionXMM(QString("XMM"), this); 127 | actionXMM.setCheckable(true); 128 | actionXMM.setChecked(getOptions().bXMM); 129 | connect(&actionXMM, SIGNAL(triggered()), this, SLOT(_actionViewXMM())); 130 | menuView.addAction(&actionXMM); 131 | 132 | QAction actionYMM(QString("YMM"), this); 133 | actionYMM.setCheckable(true); 134 | actionYMM.setChecked(getOptions().bYMM); 135 | connect(&actionYMM, SIGNAL(triggered()), this, SLOT(_actionViewYMM())); 136 | menuView.addAction(&actionYMM); 137 | #endif 138 | 139 | contextMenu.addMenu(&menuView); 140 | 141 | contextMenu.exec(viewport()->mapToGlobal(pos)); 142 | } 143 | 144 | void DW_RegistersView::registerShortcuts(bool bState) 145 | { 146 | if (bState) { 147 | if (!shortCuts[SC_REGISTERS_EDIT]) 148 | shortCuts[SC_REGISTERS_EDIT] = new QShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_REGISTERS_EDIT), this, SLOT(_actionEdit())); 149 | if (!shortCuts[SC_REGISTERS_CLEAR]) 150 | shortCuts[SC_REGISTERS_CLEAR] = new QShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_REGISTERS_CLEAR), this, SLOT(_actionClear())); 151 | } else { 152 | for (qint32 i = 0; i < __SC_SIZE; i++) { 153 | if (shortCuts[i]) { 154 | delete shortCuts[i]; 155 | shortCuts[i] = nullptr; 156 | } 157 | } 158 | } 159 | } 160 | 161 | void DW_RegistersView::_followInDisasmSlot() 162 | { 163 | QAction *pAction = qobject_cast(sender()); 164 | 165 | if (pAction) { 166 | XADDR nAddress = pAction->property("ADDRESS").toULongLong(); 167 | 168 | emit followInDisasm(nAddress); 169 | } 170 | } 171 | 172 | void DW_RegistersView::_followInHexSlot() 173 | { 174 | QAction *pAction = qobject_cast(sender()); 175 | 176 | if (pAction) { 177 | XADDR nAddress = pAction->property("ADDRESS").toULongLong(); 178 | 179 | emit followInHex(nAddress); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /xdebuggerloaddialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | XDebuggerLoadDialog 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 543 13 | 466 14 | 15 | 16 | 17 | Load 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | File name 27 | 28 | 29 | 30 | 0 31 | 32 | 33 | 0 34 | 35 | 36 | 0 37 | 38 | 39 | 0 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Arguments 51 | 52 | 53 | 54 | 0 55 | 56 | 57 | 0 58 | 59 | 60 | 0 61 | 62 | 63 | 0 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Directory 75 | 76 | 77 | 78 | 0 79 | 80 | 81 | 0 82 | 83 | 84 | 0 85 | 86 | 87 | 0 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | Options 101 | 102 | 103 | 104 | 0 105 | 106 | 107 | 0 108 | 109 | 110 | 0 111 | 112 | 113 | 0 114 | 115 | 116 | 0 117 | 118 | 119 | 120 | 121 | Show console 122 | 123 | 124 | 125 | 126 | 127 | 128 | Change permissions 129 | 130 | 131 | 132 | 133 | 134 | 135 | Qt::Vertical 136 | 137 | 138 | 139 | 20 140 | 40 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | Breakpoints 152 | 153 | 154 | 155 | 0 156 | 157 | 158 | 0 159 | 160 | 161 | 0 162 | 163 | 164 | 0 165 | 166 | 167 | 0 168 | 169 | 170 | 171 | 172 | System 173 | 174 | 175 | 176 | 177 | 178 | 179 | Exceptions 180 | 181 | 182 | 183 | 184 | 185 | 186 | Entry point 187 | 188 | 189 | 190 | 191 | 192 | 193 | DLL main 194 | 195 | 196 | 197 | 198 | 199 | 200 | TLS functions 201 | 202 | 203 | 204 | 205 | 206 | 207 | Qt::Vertical 208 | 209 | 210 | 211 | 20 212 | 40 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | Qt::Vertical 226 | 227 | 228 | 229 | 20 230 | 162 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | Qt::Horizontal 241 | 242 | 243 | 244 | 40 245 | 20 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | Cancel 254 | 255 | 256 | 257 | 258 | 259 | 260 | OK 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | -------------------------------------------------------------------------------- /dw_disasmview.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2021-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "dw_disasmview.h" 22 | 23 | DW_DisasmView::DW_DisasmView(QWidget *pParent) : XDisasmView(pParent) 24 | { 25 | } 26 | 27 | void DW_DisasmView::_breakpointToggle() 28 | { 29 | // TODO isToggleEnable 30 | if (getXInfoDB()) { 31 | XADDR nAddress = getSelectionInitAddress(); 32 | 33 | if (nAddress != (XADDR)-1) { 34 | qint64 nSelectionSize = getSelectionInitSize(); 35 | 36 | if (getXInfoDB()->breakpointToggle(nAddress)) { 37 | getXInfoDB()->reloadView(); 38 | } 39 | 40 | setSelectionAddress(nAddress, nSelectionSize); 41 | } 42 | } 43 | } 44 | 45 | void DW_DisasmView::_breakpointRemove() 46 | { 47 | // TODO isRemoveEnable 48 | if (getXInfoDB()) { 49 | XADDR nAddress = getSelectionInitAddress(); 50 | 51 | if (nAddress != (XADDR)-1) { 52 | qint64 nSelectionSize = getSelectionInitSize(); 53 | 54 | if (getXInfoDB()->breakpointRemove(nAddress)) { 55 | getXInfoDB()->reloadView(); 56 | } 57 | 58 | setSelectionAddress(nAddress, nSelectionSize); 59 | } 60 | } 61 | } 62 | 63 | void DW_DisasmView::_breakpointConditional() 64 | { 65 | // TODO isConditionalEnable 66 | if (getXInfoDB()) { 67 | // TODO 68 | } 69 | } 70 | 71 | void DW_DisasmView::_breakpointHardware0() 72 | { 73 | } 74 | 75 | void DW_DisasmView::_breakpointHardware1() 76 | { 77 | } 78 | 79 | void DW_DisasmView::_breakpointHardware2() 80 | { 81 | } 82 | 83 | void DW_DisasmView::_breakpointHardware3() 84 | { 85 | } 86 | 87 | void DW_DisasmView::_breakpointHardwareShow() 88 | { 89 | } 90 | 91 | void DW_DisasmView::_goToAddress() 92 | { 93 | // TODO another modules 94 | _goToAddressSlot(); 95 | } 96 | 97 | void DW_DisasmView::contextMenu(const QPoint &pos) 98 | { 99 | // TODO Search 100 | // TODO Signatures 101 | if (isContextMenuEnable()) { 102 | if (getXInfoDB()) { 103 | QMenu contextMenu(this); 104 | 105 | QMenu menuBreakpoint(tr("Breakpoint"), this); 106 | QMenu menuBreakpointHardware(tr("Hardware"), this); 107 | QMenu menuGoTo(tr("Go to"), this); 108 | QMenu menuCopy(tr("Copy"), this); 109 | QMenu menuEdit(tr("Edit"), this); 110 | QMenu menuFollowIn(tr("Follow in"), this); 111 | 112 | QAction actionBreakpointToggle(tr("Toggle"), this); 113 | actionBreakpointToggle.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_BREAKPOINT_TOGGLE)); 114 | connect(&actionBreakpointToggle, SIGNAL(triggered()), this, SLOT(_breakpointToggle())); 115 | 116 | QAction actionBreakpointRemove(tr("Remove"), this); 117 | actionBreakpointRemove.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_BREAKPOINT_REMOVE)); 118 | connect(&actionBreakpointRemove, SIGNAL(triggered()), this, SLOT(_breakpointRemove())); 119 | 120 | QAction actionBreakpointConditional(tr("Conditional"), this); 121 | actionBreakpointConditional.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_BREAKPOINT_CONDITIONAL)); 122 | connect(&actionBreakpointConditional, SIGNAL(triggered()), this, SLOT(_breakpointConditional())); 123 | 124 | QAction actionGoToAddress(tr("Address"), this); 125 | actionGoToAddress.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_GOTO_ADDRESS)); 126 | connect(&actionGoToAddress, SIGNAL(triggered()), this, SLOT(_goToAddressSlot())); // TODO go to custom slot 127 | 128 | QAction actionCopyAddress(tr("Address"), this); 129 | actionCopyAddress.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_COPY_ADDRESS)); 130 | connect(&actionCopyAddress, SIGNAL(triggered()), this, SLOT(_copyAddressSlot())); 131 | 132 | QAction actionEditHex(tr("Hex"), this); 133 | actionEditHex.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_EDIT_HEX)); 134 | connect(&actionEditHex, SIGNAL(triggered()), this, SLOT(_editHex())); 135 | 136 | QAction actionFollowInHex(tr("Hex"), this); 137 | actionFollowInHex.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_FOLLOWIN_HEX)); 138 | connect(&actionFollowInHex, SIGNAL(triggered()), this, SLOT(_followInHexSlot())); 139 | 140 | QAction actionBreakpointHardware0("", this); 141 | actionBreakpointHardware0.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_BREAKPOINT_HARDWARE_0)); 142 | connect(&actionBreakpointHardware0, SIGNAL(triggered()), this, SLOT(_breakpointHardware0())); 143 | QAction actionBreakpointHardware1("", this); 144 | actionBreakpointHardware1.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_BREAKPOINT_HARDWARE_1)); 145 | connect(&actionBreakpointHardware1, SIGNAL(triggered()), this, SLOT(_breakpointHardware1())); 146 | QAction actionBreakpointHardware2("", this); 147 | actionBreakpointHardware2.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_BREAKPOINT_HARDWARE_2)); 148 | connect(&actionBreakpointHardware2, SIGNAL(triggered()), this, SLOT(_breakpointHardware2())); 149 | QAction actionBreakpointHardware3("", this); 150 | actionBreakpointHardware3.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_BREAKPOINT_HARDWARE_3)); 151 | connect(&actionBreakpointHardware3, SIGNAL(triggered()), this, SLOT(_breakpointHardware3())); 152 | 153 | QAction actionBreakpointHardwareShow(tr("Show"), this); 154 | actionBreakpointHardwareShow.setShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_BREAKPOINT_HARDWARE_SHOW)); 155 | connect(&actionBreakpointHardwareShow, SIGNAL(triggered()), this, SLOT(_breakpointHardwareShow())); 156 | 157 | menuGoTo.addAction(&actionGoToAddress); 158 | contextMenu.addMenu(&menuGoTo); 159 | 160 | menuBreakpoint.addAction(&actionBreakpointToggle); 161 | menuBreakpointHardware.addAction(&actionBreakpointHardware0); 162 | menuBreakpointHardware.addAction(&actionBreakpointHardware1); 163 | menuBreakpointHardware.addAction(&actionBreakpointHardware2); 164 | menuBreakpointHardware.addAction(&actionBreakpointHardware3); 165 | menuBreakpointHardware.addSeparator(); 166 | menuBreakpointHardware.addAction(&actionBreakpointHardwareShow); 167 | 168 | menuBreakpoint.addMenu(&menuBreakpointHardware); 169 | contextMenu.addMenu(&menuBreakpoint); 170 | 171 | menuCopy.addAction(&actionCopyAddress); 172 | contextMenu.addMenu(&menuCopy); 173 | 174 | menuEdit.addAction(&actionEditHex); 175 | contextMenu.addMenu(&menuEdit); 176 | 177 | menuFollowIn.addAction(&actionFollowInHex); 178 | contextMenu.addMenu(&menuFollowIn); 179 | 180 | contextMenu.exec(pos); 181 | 182 | // qint64 nAddress=getSelectionInitAddress(); 183 | // if(!g_pDebugger->isSoftwareBreakpointPresent(nAddress)) 184 | // { 185 | // actionToggle.setText(tr("Set Breakpoint")); 186 | // } 187 | // else 188 | // { 189 | // actionToggle.setText(tr("Remove Breakpoint")); 190 | // } 191 | } 192 | } 193 | } 194 | 195 | void DW_DisasmView::registerShortcuts(bool bState) 196 | { 197 | Q_UNUSED(bState) 198 | 199 | // TODO !!! 200 | } 201 | -------------------------------------------------------------------------------- /xdebuggerwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | XDebuggerWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1136 10 | 771 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 1 33 | 34 | 35 | 36 | 37 | Debug 38 | 39 | 40 | Qt::AlignCenter 41 | 42 | 43 | 44 | 0 45 | 46 | 47 | 0 48 | 49 | 50 | 0 51 | 52 | 53 | 0 54 | 55 | 56 | 0 57 | 58 | 59 | 60 | 61 | 62 | 0 63 | 0 64 | 65 | 66 | 67 | 68 | 48 69 | 48 70 | 71 | 72 | 73 | Run 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 48 82 | 48 83 | 84 | 85 | 86 | SI 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 48 95 | 48 96 | 97 | 98 | 99 | SO 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | Animate 110 | 111 | 112 | Qt::AlignCenter 113 | 114 | 115 | 116 | 0 117 | 118 | 119 | 0 120 | 121 | 122 | 0 123 | 124 | 125 | 0 126 | 127 | 128 | 0 129 | 130 | 131 | 132 | 133 | 134 | 0 135 | 0 136 | 137 | 138 | 139 | 140 | 48 141 | 48 142 | 143 | 144 | 145 | SI 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 48 154 | 48 155 | 156 | 157 | 158 | SO 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 48 167 | 48 168 | 169 | 170 | 171 | Stop 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | Trace 182 | 183 | 184 | Qt::AlignCenter 185 | 186 | 187 | 188 | 0 189 | 190 | 191 | 0 192 | 193 | 194 | 0 195 | 196 | 197 | 0 198 | 199 | 200 | 0 201 | 202 | 203 | 204 | 205 | 206 | 0 207 | 0 208 | 209 | 210 | 211 | 212 | 48 213 | 48 214 | 215 | 216 | 217 | SI 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 48 226 | 48 227 | 228 | 229 | 230 | SO 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 48 239 | 48 240 | 241 | 242 | 243 | Stop 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | Command 254 | 255 | 256 | 257 | 0 258 | 259 | 260 | 0 261 | 262 | 263 | 0 264 | 265 | 266 | 0 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 24 276 | 24 277 | 278 | 279 | 280 | > 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | Qt::Horizontal 291 | 292 | 293 | 294 | 40 295 | 20 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 0 306 | 307 | 308 | 309 | CPU 310 | 311 | 312 | 313 | 0 314 | 315 | 316 | 0 317 | 318 | 319 | 0 320 | 321 | 322 | 0 323 | 324 | 325 | 326 | 327 | Qt::Horizontal 328 | 329 | 330 | 331 | Qt::Vertical 332 | 333 | 334 | 335 | Disassembler 336 | 337 | 338 | 339 | 0 340 | 341 | 342 | 0 343 | 344 | 345 | 0 346 | 347 | 348 | 0 349 | 350 | 351 | 352 | 353 | 354 | 0 355 | 0 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | Hex 365 | 366 | 367 | 368 | 0 369 | 370 | 371 | 0 372 | 373 | 374 | 0 375 | 376 | 377 | 0 378 | 379 | 380 | 0 381 | 382 | 383 | 384 | 385 | 386 | Hex 387 | 388 | 389 | 390 | 391 | Hex 392 | 393 | 394 | 395 | 396 | Hex 397 | 398 | 399 | 400 | 401 | Hex 402 | 403 | 404 | 405 | 406 | Hex 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | Qt::Vertical 417 | 418 | 419 | 420 | Registers 421 | 422 | 423 | 424 | 0 425 | 426 | 427 | 0 428 | 429 | 430 | 0 431 | 432 | 433 | 0 434 | 435 | 436 | 437 | 438 | 439 | 0 440 | 0 441 | 442 | 443 | 444 | true 445 | 446 | 447 | 448 | 449 | 0 450 | 0 451 | 992 452 | 484 453 | 454 | 455 | 456 | 457 | 0 458 | 0 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | Stack 469 | 470 | 471 | 472 | 0 473 | 474 | 475 | 0 476 | 477 | 478 | 0 479 | 480 | 481 | 0 482 | 483 | 484 | 485 | 486 | 487 | 0 488 | 0 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | Log 503 | 504 | 505 | 506 | 0 507 | 508 | 509 | 0 510 | 511 | 512 | 0 513 | 514 | 515 | 0 516 | 517 | 518 | 519 | 520 | true 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | Breakpoints 529 | 530 | 531 | 532 | 0 533 | 534 | 535 | 0 536 | 537 | 538 | 0 539 | 540 | 541 | 0 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | Memory map 551 | 552 | 553 | 554 | 0 555 | 556 | 557 | 0 558 | 559 | 560 | 0 561 | 562 | 563 | 0 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | Call stack 573 | 574 | 575 | 576 | 577 | Threads 578 | 579 | 580 | 581 | 0 582 | 583 | 584 | 0 585 | 586 | 587 | 0 588 | 589 | 590 | 0 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | Handles 600 | 601 | 602 | 603 | 604 | Modules 605 | 606 | 607 | 608 | 0 609 | 610 | 611 | 0 612 | 613 | 614 | 0 615 | 616 | 617 | 0 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | Symbols 627 | 628 | 629 | 630 | 0 631 | 632 | 633 | 0 634 | 635 | 636 | 0 637 | 638 | 639 | 0 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | DW_HexView 653 | QWidget 654 |
dw_hexview.h
655 | 1 656 |
657 | 658 | DW_DisasmView 659 | QWidget 660 |
dw_disasmview.h
661 | 1 662 |
663 | 664 | DW_RegistersView 665 | QWidget 666 |
dw_registersview.h
667 | 1 668 |
669 | 670 | DW_StackView 671 | QWidget 672 |
dw_stackview.h
673 | 1 674 |
675 | 676 | DW_ProcessMemoryMapWidget 677 | QWidget 678 |
dw_processmemorymapwidget.h
679 | 1 680 |
681 | 682 | DW_ProcessModulesWidget 683 | QWidget 684 |
dw_processmoduleswidget.h
685 | 1 686 |
687 | 688 | DW_ThreadsWidget 689 | QWidget 690 |
dw_threadswidget.h
691 | 1 692 |
693 | 694 | DW_SymbolsWidget 695 | QWidget 696 |
dw_symbolswidget.h
697 | 1 698 |
699 | 700 | DW_BreakPointsWidget 701 | QWidget 702 |
dw_breakpointswidget.h
703 | 1 704 |
705 |
706 | 707 | 708 |
709 | -------------------------------------------------------------------------------- /xdebuggerwidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2022-2025 hors 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to deal 5 | * in the Software without restriction, including without limitation the rights 6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | * copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in all 11 | * copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | * SOFTWARE. 20 | */ 21 | #include "xdebuggerwidget.h" 22 | #include "ui_xdebuggerwidget.h" 23 | 24 | XDebuggerWidget::XDebuggerWidget(QWidget *pParent) : XShortcutsWidget(pParent), ui(new Ui::XDebuggerWidget) 25 | { 26 | ui->setupUi(this); 27 | #ifdef Q_OS_WIN 28 | g_pThread = nullptr; 29 | #endif 30 | g_pDebugger = nullptr; 31 | g_pInfoDB = nullptr; 32 | g_pMutex = new QMutex; 33 | 34 | g_currentBreakPointInfo = {}; 35 | 36 | memset(shortCuts, 0, sizeof shortCuts); 37 | 38 | g_mrDisasm = {}; 39 | g_mrStack = {}; 40 | g_mrHex = {}; 41 | g_pTimer = nullptr; 42 | 43 | g_state = {}; 44 | 45 | _adjustState(); 46 | 47 | // qRegisterMetaType("XBinary::PROCESS_STATUS"); 48 | qRegisterMetaType("X_ID"); 49 | qRegisterMetaType("X_HANDLE"); 50 | qRegisterMetaType("X_HANDLE_IO"); 51 | qRegisterMetaType("X_HANDLE_MQ"); 52 | qRegisterMetaType("XADDR"); 53 | 54 | connect(this, SIGNAL(resetWidgetsSignal()), this, SLOT(resetWidgets())); 55 | connect(this, SIGNAL(infoMessage(QString)), this, SLOT(infoMessageSlot(QString))); 56 | connect(this, SIGNAL(errorMessage(QString)), this, SLOT(errorMessageSlot(QString))); 57 | connect(this, SIGNAL(warningMessage(QString)), this, SLOT(warningMessageSlot(QString))); 58 | 59 | connect(this, SIGNAL(addSymbols(QString, XADDR)), this, SLOT(addSymbolsSlot(QString, XADDR))); 60 | connect(this, SIGNAL(removeSymbols(QString)), this, SLOT(removeSymbolsSlot(QString))); 61 | // ui->widgetDisasm->installEventFilter(this); 62 | // XDebuggerWidget::registerShortcuts(true); 63 | // connect(ui->widgetDisasm,SIGNAL(debugAction(XInfoDB::DEBUG_ACTION)),this,SLOT(addDebugAction(XInfoDB::DEBUG_ACTION))); 64 | 65 | connect(ui->widgetDisasm, SIGNAL(followInHex(XADDR)), this, SLOT(followInHex(XADDR))); 66 | connect(ui->widgetHex1, SIGNAL(followInDisasm(XADDR)), this, SLOT(followInDisasm(XADDR))); 67 | connect(ui->widgetHex2, SIGNAL(followInDisasm(XADDR)), this, SLOT(followInDisasm(XADDR))); 68 | connect(ui->widgetHex3, SIGNAL(followInDisasm(XADDR)), this, SLOT(followInDisasm(XADDR))); 69 | connect(ui->widgetHex4, SIGNAL(followInDisasm(XADDR)), this, SLOT(followInDisasm(XADDR))); 70 | connect(ui->widgetHex5, SIGNAL(followInDisasm(XADDR)), this, SLOT(followInDisasm(XADDR))); 71 | connect(ui->widgetStack, SIGNAL(followInHex(XADDR)), this, SLOT(followInHex(XADDR))); 72 | connect(ui->widgetStack, SIGNAL(followInDisasm(XADDR)), this, SLOT(followInDisasm(XADDR))); 73 | connect(ui->widgetRegs, SIGNAL(followInHex(XADDR)), this, SLOT(followInHex(XADDR))); 74 | connect(ui->widgetRegs, SIGNAL(followInDisasm(XADDR)), this, SLOT(followInDisasm(XADDR))); 75 | 76 | ui->tabWidgetMain->setCurrentIndex(MT_CPU); 77 | } 78 | 79 | XDebuggerWidget::~XDebuggerWidget() 80 | { 81 | // qDebug("XDebuggerWidget::~XDebuggerWidget()"); 82 | cleanUp(); 83 | 84 | delete g_pMutex; 85 | delete ui; 86 | } 87 | 88 | bool XDebuggerWidget::loadFile(const QString &sFileName, bool bShowLoadDialog) 89 | { 90 | bool bResult = false; // TODO check 91 | 92 | // TODO Check function 93 | 94 | if (!bShowLoadDialog) { 95 | bResult = true; 96 | } 97 | 98 | XAbstractDebugger::OPTIONS options = XAbstractDebugger::getDefaultOptions(sFileName); 99 | 100 | if (bShowLoadDialog) { 101 | XDebuggerLoadDialog debuggerLoadDialog(this, &options); 102 | 103 | if (debuggerLoadDialog.exec() == QDialog::Accepted) { 104 | bResult = true; 105 | } 106 | } 107 | 108 | if (bResult) { 109 | resetWidgets(); 110 | cleanUp(); 111 | 112 | g_pInfoDB = new XInfoDB; 113 | g_pInfoDB->setDebuggerState(true); 114 | 115 | #ifdef Q_OS_WIN 116 | g_pThread = new QThread; 117 | g_pDebugger = new XWindowsDebugger(0, g_pInfoDB); 118 | #endif 119 | #ifdef Q_OS_LINUX 120 | g_pDebugger = new XLinuxDebugger(0, g_pInfoDB); 121 | #endif 122 | #ifdef Q_OS_MACOS 123 | g_pDebugger = new XOSXDebugger(0, g_pInfoDB); 124 | #endif 125 | ui->widgetDisasm->setXInfoDB(g_pDebugger->getXInfoDB()); 126 | ui->widgetHex1->setXInfoDB(g_pDebugger->getXInfoDB()); 127 | ui->widgetHex2->setXInfoDB(g_pDebugger->getXInfoDB()); 128 | ui->widgetHex3->setXInfoDB(g_pDebugger->getXInfoDB()); 129 | ui->widgetHex4->setXInfoDB(g_pDebugger->getXInfoDB()); 130 | ui->widgetHex5->setXInfoDB(g_pDebugger->getXInfoDB()); 131 | ui->widgetRegs->setXInfoDB(g_pDebugger->getXInfoDB()); 132 | ui->widgetStack->setXInfoDB(g_pDebugger->getXInfoDB()); 133 | 134 | ui->widgetProcessModules->setXInfoDB(g_pDebugger->getXInfoDB(), false); 135 | ui->widgetProcessMemoryMap->setXInfoDB(g_pDebugger->getXInfoDB(), false); 136 | ui->widgetBreakpoints->setXInfoDB(g_pDebugger->getXInfoDB(), false); 137 | 138 | XSymbolsWidget::OPTIONS sym_options = {}; 139 | sym_options.symbolMode = XInfoDB::SYMBOL_MODE_ALL; 140 | 141 | ui->widgetSymbols->setData(nullptr, sym_options, g_pDebugger->getXInfoDB(), true); 142 | ui->widgetThreads->setXInfoDB(g_pDebugger->getXInfoDB(), false); 143 | 144 | // g_osInfo = XProcess::getOsInfo(); 145 | 146 | g_pDebugger->setOptions(options); 147 | 148 | #ifdef Q_OS_WIN 149 | connect(g_pThread, SIGNAL(started()), g_pDebugger, SLOT(process())); 150 | #endif 151 | // connect(pDebugger,SIGNAL(finished()),pDebugger,SLOT(deleteLater())); 152 | 153 | connect(g_pDebugger, SIGNAL(infoMessage(QString)), this, SLOT(infoMessageSlot(QString)), Qt::DirectConnection); 154 | connect(g_pDebugger, SIGNAL(errorMessage(QString)), this, SLOT(errorMessageSlot(QString)), Qt::DirectConnection); 155 | connect(g_pDebugger, SIGNAL(warningMessage(QString)), this, SLOT(warningMessageSlot(QString)), Qt::DirectConnection); 156 | 157 | connect(g_pDebugger, SIGNAL(eventCreateProcess(XInfoDB::PROCESS_INFO *)), this, SLOT(onCreateProcess(XInfoDB::PROCESS_INFO *)), Qt::DirectConnection); 158 | connect(g_pDebugger, SIGNAL(eventBreakPoint(XInfoDB::BREAKPOINT_INFO *)), this, SLOT(onBreakPoint(XInfoDB::BREAKPOINT_INFO *)), Qt::DirectConnection); 159 | connect(g_pDebugger, SIGNAL(eventExitProcess(XInfoDB::EXITPROCESS_INFO *)), this, SLOT(onExitProcess(XInfoDB::EXITPROCESS_INFO *)), Qt::DirectConnection); 160 | connect(g_pDebugger, SIGNAL(eventCreateThread(XInfoDB::THREAD_INFO *)), this, SLOT(eventCreateThread(XInfoDB::THREAD_INFO *)), Qt::DirectConnection); 161 | connect(g_pDebugger, SIGNAL(eventExitThread(XInfoDB::EXITTHREAD_INFO *)), this, SLOT(eventExitThread(XInfoDB::EXITTHREAD_INFO *)), Qt::DirectConnection); 162 | connect(g_pDebugger, SIGNAL(eventLoadSharedObject(XInfoDB::SHAREDOBJECT_INFO *)), this, SLOT(eventLoadSharedObject(XInfoDB::SHAREDOBJECT_INFO *)), 163 | Qt::DirectConnection); 164 | connect(g_pDebugger, SIGNAL(eventUnloadSharedObject(XInfoDB::SHAREDOBJECT_INFO *)), this, SLOT(eventUnloadSharedObject(XInfoDB::SHAREDOBJECT_INFO *)), 165 | Qt::DirectConnection); 166 | 167 | // connect(this,SIGNAL(testSignal(X_ID)),g_pDebugger,SLOT(testSlot(X_ID)),Qt::BlockingQueuedConnection); 168 | // connect(this,SIGNAL(testSignal(X_ID)),g_pDebugger,SLOT(testSlot(X_ID)),Qt::QueuedConnection); 169 | 170 | connect(g_pInfoDB, SIGNAL(reloadViewSignal()), this, SLOT(onReloadSignal())); // TODO remove 171 | 172 | // connect(g_pInfoDB, SIGNAL(memoryRegionsListChanged()), this, SLOT(memoryRegionsListChangedSlot())); 173 | connect(g_pInfoDB, SIGNAL(modulesListChanged()), this, SLOT(modulesListChangedSlot())); 174 | connect(g_pInfoDB, SIGNAL(threadsListChanged()), this, SLOT(threadsListChangedSlot())); 175 | connect(g_pInfoDB, SIGNAL(registersListChanged()), this, SLOT(registersListChangedSlot())); 176 | 177 | #ifdef Q_OS_WIN 178 | g_pDebugger->moveToThread(g_pThread); 179 | g_pThread->start(); 180 | #endif 181 | #if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) 182 | g_pDebugger->process(); 183 | #endif 184 | 185 | if (bResult) { 186 | command(CM_READY); 187 | } 188 | } 189 | 190 | return bResult; 191 | } 192 | 193 | void XDebuggerWidget::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions) 194 | { 195 | setActive(true); 196 | 197 | ui->widgetDisasm->setGlobal(pShortcuts, pXOptions); 198 | ui->widgetHex1->setGlobal(pShortcuts, pXOptions); 199 | ui->widgetHex2->setGlobal(pShortcuts, pXOptions); 200 | ui->widgetHex3->setGlobal(pShortcuts, pXOptions); 201 | ui->widgetHex4->setGlobal(pShortcuts, pXOptions); 202 | ui->widgetHex5->setGlobal(pShortcuts, pXOptions); 203 | ui->widgetRegs->setGlobal(pShortcuts, pXOptions); 204 | ui->widgetStack->setGlobal(pShortcuts, pXOptions); 205 | // TODO more 206 | 207 | XShortcutsWidget::setGlobal(pShortcuts, pXOptions); 208 | } 209 | 210 | void XDebuggerWidget::adjustView() 211 | { 212 | ui->widgetDisasm->adjustView(); 213 | ui->widgetHex1->adjustView(); 214 | ui->widgetHex2->adjustView(); 215 | ui->widgetHex3->adjustView(); 216 | ui->widgetHex4->adjustView(); 217 | ui->widgetHex5->adjustView(); 218 | ui->widgetRegs->adjustView(); 219 | ui->widgetStack->adjustView(); 220 | ui->widgetProcessModules->adjustView(); 221 | ui->widgetProcessMemoryMap->adjustView(); 222 | ui->widgetBreakpoints->adjustView(); 223 | ui->widgetSymbols->adjustView(); 224 | ui->widgetThreads->adjustView(); 225 | } 226 | 227 | void XDebuggerWidget::reloadShortcuts() 228 | { 229 | ui->widgetDisasm->reloadShortcuts(); 230 | ui->widgetHex1->reloadShortcuts(); 231 | ui->widgetHex2->reloadShortcuts(); 232 | ui->widgetHex3->reloadShortcuts(); 233 | ui->widgetHex4->reloadShortcuts(); 234 | ui->widgetHex5->reloadShortcuts(); 235 | ui->widgetRegs->reloadShortcuts(); 236 | ui->widgetStack->reloadShortcuts(); 237 | ui->widgetProcessModules->reloadShortcuts(); 238 | ui->widgetProcessMemoryMap->reloadShortcuts(); 239 | ui->widgetBreakpoints->reloadShortcuts(); 240 | ui->widgetSymbols->reloadShortcuts(); 241 | ui->widgetThreads->adjustView(); 242 | 243 | XShortcutsWidget::reloadShortcuts(); 244 | } 245 | 246 | XDebuggerWidget::STATE XDebuggerWidget::getState() 247 | { 248 | return g_state; 249 | } 250 | 251 | void XDebuggerWidget::onCreateProcess(XInfoDB::PROCESS_INFO *pProcessInfo) 252 | { 253 | // TODO more info 254 | QString sString = QString("%1 PID: %2").arg(tr("Process created"), QString::number(pProcessInfo->nProcessID)); 255 | 256 | emit infoMessage(sString); 257 | emit addSymbols(pProcessInfo->sFileName, pProcessInfo->nImageBase); 258 | } 259 | 260 | void XDebuggerWidget::onBreakPoint(XInfoDB::BREAKPOINT_INFO *pBreakPointInfo) 261 | { 262 | g_currentBreakPointInfo = *pBreakPointInfo; 263 | #ifdef QT_DEBUG 264 | qDebug("ExceptionAddress %llx", pBreakPointInfo->nExceptionAddress); 265 | #endif 266 | // mb TODO regs 267 | 268 | // qDebug("Current Address2: %llX",XAbstractDebugger::getCurrentAddress(handleThread)); 269 | g_pInfoDB->updateMemoryRegionsList(); 270 | g_pInfoDB->updateModulesList(); 271 | g_pInfoDB->updateThreadsList(); 272 | 273 | #if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) 274 | g_pInfoDB->updateRegsById(pBreakPointInfo->nThreadID, ui->widgetRegs->getOptions()); 275 | qDebug("TODO remove"); 276 | g_pInfoDB->getHardwareBP_Id(pBreakPointInfo->nThreadID); 277 | #endif 278 | #ifdef Q_OS_WIN 279 | // g_pInfoDB->suspendThread(pBreakPointInfo->hThread); 280 | g_pInfoDB->updateRegsByHandle(pBreakPointInfo->hThread, ui->widgetRegs->getOptions()); 281 | 282 | #ifdef QT_DEBUG 283 | qDebug("TODO remove"); 284 | g_pInfoDB->getHardwareBP_Handle(pBreakPointInfo->hThread); 285 | #endif 286 | #endif 287 | // TODO reloads signals 288 | 289 | // g_pInfoDB->clearRecordInfoCache(); 290 | 291 | g_pInfoDB->reloadView(); 292 | } 293 | 294 | void XDebuggerWidget::onExitProcess(XInfoDB::EXITPROCESS_INFO *pExitProcessInfo) 295 | { 296 | // TODO more info 297 | QString sString = QString("%1 PID: %2").arg(tr("Process exited"), QString::number(pExitProcessInfo->nProcessID)); 298 | 299 | emit infoMessage(sString); 300 | 301 | removeSymbols(pExitProcessInfo->sFileName); 302 | 303 | emit resetWidgetsSignal(); 304 | } 305 | 306 | void XDebuggerWidget::eventCreateThread(XInfoDB::THREAD_INFO *pThreadInfo) 307 | { 308 | // TODO more info 309 | QString sString = QString("%1 ThreadID: %2").arg(tr("Thread created"), QString::number(pThreadInfo->nThreadID)); 310 | 311 | emit infoMessage(sString); 312 | } 313 | 314 | void XDebuggerWidget::eventExitThread(XInfoDB::EXITTHREAD_INFO *pExitThreadInfo) 315 | { 316 | // TODO more info 317 | QString sString = QString("%1 ThreadID: %2").arg(tr("Thread exited"), QString::number(pExitThreadInfo->nThreadID)); 318 | 319 | emit infoMessage(sString); 320 | } 321 | 322 | void XDebuggerWidget::eventLoadSharedObject(XInfoDB::SHAREDOBJECT_INFO *pSharedObjectInfo) 323 | { 324 | // TODO more info 325 | QString sString = QString("%1: %2").arg(tr("Shared object loaded"), pSharedObjectInfo->sFileName); 326 | 327 | emit infoMessage(sString); 328 | // emit addSymbols(pSharedObjectInfo->sFileName, pSharedObjectInfo->nImageBase); 329 | } 330 | 331 | void XDebuggerWidget::eventUnloadSharedObject(XInfoDB::SHAREDOBJECT_INFO *pSharedObjectInfo) 332 | { 333 | // TODO more info 334 | QString sString = QString("%1: %2").arg(tr("Shared object unloaded"), pSharedObjectInfo->sFileName); // TODO rewrite 335 | 336 | emit infoMessage(sString); 337 | // emit removeSymbols(pSharedObjectInfo->sFileName); 338 | } 339 | 340 | void XDebuggerWidget::onReloadSignal() 341 | { 342 | qDebug("void XDebuggerWidget::onReloadSignal(bool bDataReload)"); 343 | // TODO rework 344 | if (true) { 345 | quint64 nInstructionPointer = g_pInfoDB->getCurrentInstructionPointerCache(); 346 | quint64 nStackPointer = g_pInfoDB->getCurrentStackPointerCache(); 347 | 348 | // TODO Check tab 349 | followInDisasm(nInstructionPointer); 350 | followInStack(nStackPointer); 351 | followInHex(g_pInfoDB->getProcessInfo()->nImageBase); // TODO 352 | } 353 | 354 | reload(); // TODO Check remove 355 | } 356 | 357 | void XDebuggerWidget::on_toolButtonRun_clicked() 358 | { 359 | debugRun(); 360 | } 361 | 362 | void XDebuggerWidget::on_toolButtonStepInto_clicked() 363 | { 364 | debugStepInto(); 365 | } 366 | 367 | void XDebuggerWidget::on_toolButtonStepOver_clicked() 368 | { 369 | debugStepOver(); 370 | } 371 | 372 | bool XDebuggerWidget::debugRun() 373 | { 374 | return command(CM_DEBUG_RUN); 375 | } 376 | 377 | bool XDebuggerWidget::debugClose() 378 | { 379 | return command(CM_DEBUG_CLOSE); 380 | } 381 | 382 | bool XDebuggerWidget::debugStepInto() 383 | { 384 | return command(CM_DEBUG_STEPINTO); 385 | } 386 | 387 | bool XDebuggerWidget::debugStepOver() 388 | { 389 | return command(CM_DEBUG_STEPOVER); 390 | } 391 | 392 | bool XDebuggerWidget::animateStepInto() 393 | { 394 | return command(CM_ANIMATE_STEPINTO); 395 | } 396 | 397 | bool XDebuggerWidget::animateStepOver() 398 | { 399 | return command(CM_ANIMATE_STEPOVER); 400 | } 401 | 402 | bool XDebuggerWidget::animateStop() 403 | { 404 | return command(CM_ANIMATE_STOP); 405 | } 406 | 407 | bool XDebuggerWidget::traceStepInto() 408 | { 409 | return command(CM_TRACE_STEPINTO); 410 | } 411 | 412 | bool XDebuggerWidget::traceStepOver() 413 | { 414 | return command(CM_TRACE_STEPOVER); 415 | } 416 | 417 | bool XDebuggerWidget::traceStop() 418 | { 419 | return command(CM_TRACE_STOP); 420 | } 421 | 422 | bool XDebuggerWidget::command(CM commandMode) 423 | { 424 | bool bResult = false; 425 | 426 | if (g_currentBreakPointInfo.nProcessID) { 427 | if (g_pDebugger) { 428 | if (commandMode == CM_READY) { 429 | followInHex(g_pInfoDB->getProcessInfo()->nThreadLocalBase); 430 | } else if (commandMode == CM_DEBUG_RUN) { 431 | // bResult=g_pInfoDB->resumeAllThreads(); 432 | bResult = g_pDebugger->run(); 433 | } else if (commandMode == CM_DEBUG_STEPINTO) { 434 | #ifdef Q_OS_WIN 435 | bResult = g_pDebugger->stepIntoByHandle(g_currentBreakPointInfo.hThread, XInfoDB::BPI_STEPINTO); 436 | #endif 437 | #ifdef Q_OS_LINUX 438 | bResult = g_pDebugger->stepIntoById(g_currentBreakPointInfo.nProcessID, XInfoDB::BPI_STEPINTO); 439 | #endif 440 | } else if (commandMode == CM_DEBUG_STEPOVER) { 441 | #ifdef Q_OS_WIN 442 | bResult = g_pDebugger->stepOverByHandle(g_currentBreakPointInfo.hThread, XInfoDB::BPI_STEPOVER); 443 | #endif 444 | #ifdef Q_OS_LINUX 445 | bResult = g_pDebugger->stepOverById(g_currentBreakPointInfo.nProcessID, XInfoDB::BPI_STEPOVER); 446 | #endif 447 | } else if (commandMode == CM_TRACE_STEPINTO) { 448 | #ifdef Q_OS_WIN 449 | bResult = g_pDebugger->stepIntoByHandle(g_currentBreakPointInfo.hThread, XInfoDB::BPI_TRACEINTO); 450 | #endif 451 | #ifdef Q_OS_LINUX 452 | bResult = g_pDebugger->stepIntoById(g_currentBreakPointInfo.nProcessID, XInfoDB::BPI_TRACEINTO); 453 | #endif 454 | } else if (commandMode == CM_TRACE_STEPOVER) { 455 | #ifdef Q_OS_WIN 456 | bResult = g_pDebugger->stepOverByHandle(g_currentBreakPointInfo.hThread, XInfoDB::BPI_TRACEOVER); 457 | #endif 458 | #ifdef Q_OS_LINUX 459 | bResult = g_pDebugger->stepOverById(g_currentBreakPointInfo.nProcessID, XInfoDB::BPI_TRACEOVER); 460 | #endif 461 | } else if (commandMode == CM_DEBUG_CLOSE) { 462 | bResult = g_pDebugger->stop(); 463 | } 464 | } 465 | } 466 | 467 | if ((commandMode == CM_ANIMATE_STEPINTO) || (commandMode == CM_ANIMATE_STEPOVER) || (commandMode == CM_ANIMATE_STOP)) { 468 | if (g_pTimer) { 469 | g_pTimer->stop(); 470 | delete g_pTimer; 471 | g_pTimer = nullptr; 472 | 473 | bResult = true; 474 | } 475 | } 476 | 477 | if ((commandMode == CM_ANIMATE_STEPINTO) || (commandMode == CM_ANIMATE_STEPOVER)) { 478 | g_pTimer = new QTimer(this); 479 | 480 | if (commandMode == CM_ANIMATE_STEPINTO) { 481 | connect(g_pTimer, SIGNAL(timeout()), this, SLOT(debugStepInto())); 482 | } 483 | if (commandMode == CM_ANIMATE_STEPOVER) { 484 | connect(g_pTimer, SIGNAL(timeout()), this, SLOT(debugStepOver())); 485 | } 486 | 487 | g_pTimer->start(1000); // TODO const 488 | 489 | bResult = true; 490 | } 491 | 492 | if ((commandMode == CM_ANIMATE_STEPINTO) || (commandMode == CM_ANIMATE_STEPOVER)) { 493 | g_state.bAnimateStepInto = false; 494 | g_state.bAnimateStepOver = false; 495 | g_state.bAnimateStop = true; 496 | g_state.bTraceStepInto = false; 497 | g_state.bTraceStepOver = false; 498 | g_state.bTraceStop = false; 499 | 500 | _stateChanged(); 501 | } else if ((commandMode == CM_READY) || (commandMode == CM_ANIMATE_STOP)) { 502 | g_state.bAnimateStepInto = true; 503 | g_state.bAnimateStepOver = true; 504 | g_state.bAnimateStop = false; 505 | g_state.bTraceStepInto = true; 506 | g_state.bTraceStepOver = true; 507 | g_state.bTraceStop = false; 508 | 509 | _stateChanged(); 510 | } 511 | 512 | return bResult; 513 | } 514 | 515 | void XDebuggerWidget::viewCPU() 516 | { 517 | ui->tabWidgetMain->setCurrentIndex(MT_CPU); 518 | } 519 | 520 | void XDebuggerWidget::viewLog() 521 | { 522 | ui->tabWidgetMain->setCurrentIndex(MT_LOG); 523 | } 524 | 525 | void XDebuggerWidget::viewBreakpoints() 526 | { 527 | ui->tabWidgetMain->setCurrentIndex(MT_BREAKPOINTS); 528 | } 529 | 530 | void XDebuggerWidget::viewMemoryMap() 531 | { 532 | ui->tabWidgetMain->setCurrentIndex(MT_MEMORYMAP); 533 | } 534 | 535 | void XDebuggerWidget::viewCallstack() 536 | { 537 | ui->tabWidgetMain->setCurrentIndex(MT_CALLSTACK); 538 | } 539 | 540 | void XDebuggerWidget::viewThreads() 541 | { 542 | ui->tabWidgetMain->setCurrentIndex(MT_THREADS); 543 | } 544 | 545 | void XDebuggerWidget::viewHandles() 546 | { 547 | ui->tabWidgetMain->setCurrentIndex(MT_HANDLES); 548 | } 549 | 550 | void XDebuggerWidget::viewModules() 551 | { 552 | ui->tabWidgetMain->setCurrentIndex(MT_MODULES); 553 | } 554 | 555 | void XDebuggerWidget::viewSymbols() 556 | { 557 | ui->tabWidgetMain->setCurrentIndex(MT_SYMBOLS); 558 | } 559 | 560 | void XDebuggerWidget::_stateChanged() 561 | { 562 | _adjustState(); 563 | 564 | emit stateChanged(); 565 | } 566 | 567 | void XDebuggerWidget::_adjustState() 568 | { 569 | // TODO set tab CPU if debug or animate, or trace -> command 570 | ui->toolButtonAnimateStepInto->setEnabled(g_state.bAnimateStepInto); 571 | ui->toolButtonAnimateStepOver->setEnabled(g_state.bAnimateStepOver); 572 | ui->toolButtonAnimateStop->setEnabled(g_state.bAnimateStop); 573 | ui->toolButtonTraceStepInto->setEnabled(g_state.bTraceStepInto); 574 | ui->toolButtonTraceStepOver->setEnabled(g_state.bTraceStepOver); 575 | ui->toolButtonTraceStop->setEnabled(g_state.bTraceStop); 576 | 577 | if (g_state.bAnimateStop || g_state.bTraceStop) { 578 | ui->widgetDisasm->setContextMenuEnable(false); 579 | ui->widgetHex1->setContextMenuEnable(false); 580 | ui->widgetHex2->setContextMenuEnable(false); 581 | ui->widgetHex3->setContextMenuEnable(false); 582 | ui->widgetHex4->setContextMenuEnable(false); 583 | ui->widgetHex5->setContextMenuEnable(false); 584 | ui->widgetStack->setContextMenuEnable(false); 585 | // TODO registers 586 | 587 | ui->tabWidgetMain->setTabEnabled(MT_CPU, true); 588 | ui->tabWidgetMain->setTabEnabled(MT_LOG, false); 589 | ui->tabWidgetMain->setTabEnabled(MT_BREAKPOINTS, false); 590 | ui->tabWidgetMain->setTabEnabled(MT_MEMORYMAP, false); 591 | ui->tabWidgetMain->setTabEnabled(MT_CALLSTACK, false); 592 | ui->tabWidgetMain->setTabEnabled(MT_THREADS, false); 593 | ui->tabWidgetMain->setTabEnabled(MT_HANDLES, false); 594 | ui->tabWidgetMain->setTabEnabled(MT_MODULES, false); 595 | ui->tabWidgetMain->setTabEnabled(MT_SYMBOLS, false); 596 | } else { 597 | ui->widgetDisasm->setContextMenuEnable(true); 598 | ui->widgetHex1->setContextMenuEnable(true); 599 | ui->widgetHex2->setContextMenuEnable(true); 600 | ui->widgetHex3->setContextMenuEnable(true); 601 | ui->widgetHex4->setContextMenuEnable(true); 602 | ui->widgetHex5->setContextMenuEnable(true); 603 | ui->widgetStack->setContextMenuEnable(true); 604 | // TODO registers 605 | 606 | ui->tabWidgetMain->setTabEnabled(MT_CPU, true); 607 | ui->tabWidgetMain->setTabEnabled(MT_LOG, true); 608 | ui->tabWidgetMain->setTabEnabled(MT_BREAKPOINTS, true); 609 | ui->tabWidgetMain->setTabEnabled(MT_MEMORYMAP, true); 610 | ui->tabWidgetMain->setTabEnabled(MT_CALLSTACK, true); 611 | ui->tabWidgetMain->setTabEnabled(MT_THREADS, true); 612 | ui->tabWidgetMain->setTabEnabled(MT_HANDLES, true); 613 | ui->tabWidgetMain->setTabEnabled(MT_MODULES, true); 614 | ui->tabWidgetMain->setTabEnabled(MT_SYMBOLS, true); 615 | } 616 | } 617 | 618 | void XDebuggerWidget::_clearProcessMemory() 619 | { 620 | qint32 nCount = g_listRegions.count(); 621 | 622 | for (qint32 i = 0; i < nCount; i++) { 623 | g_listRegions.at(i)->close(); 624 | delete g_listRegions.at(i); 625 | } 626 | 627 | g_listRegions.clear(); 628 | } 629 | 630 | XProcess *XDebuggerWidget::_getProcessMemory(XADDR nAddress, qint64 nSize) 631 | { 632 | XProcess *pResult = nullptr; 633 | 634 | bool bCreateNew = true; 635 | 636 | qint32 nCount = g_listRegions.count(); 637 | 638 | for (qint32 i = 0; i < nCount; i++) { 639 | if ((g_listRegions.at(i)->getInitLocation() == nAddress) && (g_listRegions.at(i)->size() == nSize)) { 640 | pResult = g_listRegions.at(i); 641 | bCreateNew = false; 642 | break; 643 | } 644 | } 645 | 646 | if (bCreateNew) { 647 | #ifdef Q_OS_WIN 648 | pResult = new XProcess(nAddress, nSize, g_currentBreakPointInfo.hProcess, this); 649 | #endif 650 | #ifdef Q_OS_LINUX 651 | pResult = new XProcess(nAddress, nSize, g_currentBreakPointInfo.pHProcessMemoryIO, this); 652 | #endif 653 | #ifdef Q_OS_MACOS 654 | pResult = new XProcess(nAddress, nSize, g_currentBreakPointInfo.hProcess, this); 655 | #endif 656 | if (pResult->open(QIODevice::ReadWrite)) { 657 | connect(pResult, SIGNAL(readDataSignal(quint64, char *, qint64)), g_pInfoDB, SLOT(readDataSlot(quint64, char *, qint64)), Qt::DirectConnection); 658 | connect(pResult, SIGNAL(writeDataSignal(quint64, char *, qint64)), g_pInfoDB, SLOT(writeDataSlot(quint64, char *, qint64)), Qt::DirectConnection); 659 | 660 | g_listRegions.append(pResult); 661 | } else { 662 | delete pResult; 663 | pResult = nullptr; 664 | } 665 | } 666 | 667 | return pResult; 668 | } 669 | 670 | void XDebuggerWidget::_breakpointToggle() 671 | { 672 | ui->widgetDisasm->_breakpointToggle(); 673 | 674 | // QList listReplaces=g_pDebugger->getMemoryReplaces(); 675 | 676 | // ui->widgetDisasm->setMemoryReplaces(listReplaces); // TODO remove 677 | // ui->widgetHex->setMemoryReplaces(listReplaces); // TODO remove 678 | // ui->widgetStack->setMemoryReplaces(listReplaces); // TODO remove 679 | 680 | // ui->widgetDisasm->reload(true); // TODO signal/slot 681 | // ui->widgetHex->reload(true); // TODO signal/slot 682 | // ui->widgetStack->reload(true); // TODO signal/slot 683 | } 684 | 685 | void XDebuggerWidget::_breakpointRemove() 686 | { 687 | ui->widgetDisasm->_breakpointRemove(); 688 | } 689 | 690 | void XDebuggerWidget::_breakpointConditional() 691 | { 692 | ui->widgetDisasm->_breakpointConditional(); 693 | } 694 | 695 | void XDebuggerWidget::cleanUp() 696 | { 697 | #ifdef QT_DEBUG 698 | qDebug("void XDebuggerWidget::cleanUp()"); 699 | #endif 700 | 701 | if (g_pDebugger) { 702 | g_pDebugger->cleanUp(); 703 | 704 | delete g_pDebugger; 705 | g_pDebugger = nullptr; 706 | } 707 | #ifdef Q_OS_WIN 708 | if (g_pThread) { 709 | g_pThread->quit(); 710 | g_pThread->wait(); // TODO 711 | 712 | delete g_pThread; 713 | g_pThread = nullptr; 714 | } 715 | #endif 716 | // TODO reset all widgets 717 | if (g_pInfoDB) { 718 | delete g_pInfoDB; 719 | g_pInfoDB = nullptr; 720 | } 721 | 722 | _clearProcessMemory(); 723 | 724 | g_mrDisasm = {}; 725 | g_mrStack = {}; 726 | g_mrHex = {}; 727 | 728 | if (g_pTimer) { 729 | g_pTimer->stop(); 730 | delete g_pTimer; 731 | g_pTimer = nullptr; 732 | } 733 | 734 | g_state = {}; 735 | 736 | _stateChanged(); 737 | } 738 | 739 | void XDebuggerWidget::resetWidgets() 740 | { 741 | ui->tabWidgetMain->setCurrentIndex(MT_CPU); 742 | 743 | ui->widgetDisasm->clear(); 744 | ui->widgetHex1->clear(); 745 | ui->widgetHex2->clear(); 746 | ui->widgetHex3->clear(); 747 | ui->widgetHex4->clear(); 748 | ui->widgetHex5->clear(); 749 | ui->widgetRegs->clear(); 750 | ui->widgetStack->clear(); 751 | } 752 | 753 | void XDebuggerWidget::errorMessageSlot(const QString &sErrorMessage) 754 | { 755 | QMessageBox::critical(this, tr("Error"), sErrorMessage); 756 | // TODO 757 | writeToLog(sErrorMessage); 758 | } 759 | 760 | void XDebuggerWidget::infoMessageSlot(const QString &sInfoMessage) 761 | { 762 | // TODO 763 | writeToLog(sInfoMessage); 764 | } 765 | 766 | void XDebuggerWidget::warningMessageSlot(const QString &sInfoMessage) 767 | { 768 | // TODO 769 | writeToLog(sInfoMessage); 770 | } 771 | 772 | void XDebuggerWidget::writeToLog(const QString &sText) 773 | { 774 | // TODO Show in title count of new messages 775 | ui->plainTextEditLog->appendPlainText(sText); 776 | } 777 | 778 | void XDebuggerWidget::registerShortcuts(bool bState) 779 | { 780 | if (bState) { 781 | if (!shortCuts[SC_DISASM_BREAKPOINTTOGGLE]) 782 | shortCuts[SC_DISASM_BREAKPOINTTOGGLE] = new QShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_BREAKPOINT_TOGGLE), this, SLOT(_breakpointToggle())); 783 | if (!shortCuts[SC_DISASM_BREAKPOINTREMOVE]) 784 | shortCuts[SC_DISASM_BREAKPOINTREMOVE] = new QShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_BREAKPOINT_REMOVE), this, SLOT(_breakpointRemove())); 785 | if (!shortCuts[SC_DISASM_BREAKPOINTCONDITIONAL]) 786 | shortCuts[SC_DISASM_BREAKPOINTCONDITIONAL] = 787 | new QShortcut(getShortcuts()->getShortcut(X_ID_DEBUGGER_DISASM_BREAKPOINT_CONDITIONAL), this, SLOT(_breakpointConditional())); 788 | } else { 789 | for (qint32 i = 0; i < __SC_SIZE; i++) { 790 | if (shortCuts[i]) { 791 | delete shortCuts[i]; 792 | shortCuts[i] = nullptr; 793 | } 794 | } 795 | } 796 | // TODO more 797 | // TODO Check if main window contains the shortcuts 798 | 799 | if (bState) { 800 | #ifdef QT_DEBUG 801 | qDebug("registerShortcuts"); 802 | #endif 803 | // if(!g_scRun) g_scRun =new QShortcut(getShortcuts()->getShortcut(XShortcuts::ID_DEBUGGER_RUN), this,SLOT(_run())); 804 | // if(!g_scStepInto) g_scStepInto =new QShortcut(getShortcuts()->getShortcut(XShortcuts::ID_DEBUGGER_STEPINTO), 805 | // this,SLOT(_stepInto())); if(!g_scStepOver) g_scStepOver =new 806 | // QShortcut(getShortcuts()->getShortcut(XShortcuts::ID_DEBUGGER_STEPOVER), this,SLOT(_stepOver())); if(!g_scBreakpointToggle) 807 | // g_scBreakpointToggle =new QShortcut(getShortcuts()->getShortcut(XShortcuts::ID_DEBUGGER_DISASM_BREAKPOINTTOGGLE), 808 | // this,SLOT(_toggleBreakpoint())); 809 | } else { 810 | #ifdef QT_DEBUG 811 | qDebug("unregisterShortcuts"); 812 | #endif 813 | // if(g_scRun) {delete g_scRun; g_scRun=nullptr;} 814 | // if(g_scStepInto) {delete g_scStepInto; g_scStepInto=nullptr;} 815 | // if(g_scStepOver) {delete g_scStepOver; g_scStepOver=nullptr;} 816 | // if(g_scBreakpointToggle) {delete g_scBreakpointToggle; g_scBreakpointToggle=nullptr;} 817 | } 818 | } 819 | 820 | void XDebuggerWidget::on_tabWidgetMain_currentChanged(int nIndex) 821 | { 822 | Q_UNUSED(nIndex) 823 | 824 | reload(); 825 | } 826 | 827 | void XDebuggerWidget::reload() 828 | { 829 | qint32 nIndex = ui->tabWidgetMain->currentIndex(); 830 | 831 | if (nIndex == MT_CPU) { 832 | ui->widgetDisasm->reload(true); 833 | ui->widgetHex1->reload(true); 834 | ui->widgetHex2->reload(true); 835 | ui->widgetHex3->reload(true); 836 | ui->widgetHex4->reload(true); 837 | ui->widgetHex5->reload(true); 838 | ui->widgetStack->reload(true); 839 | ui->widgetRegs->reload(); 840 | } else if (nIndex == MT_BREAKPOINTS) { 841 | ui->widgetBreakpoints->reload(); 842 | } else if (nIndex == MT_MEMORYMAP) { 843 | ui->widgetProcessMemoryMap->reload(); 844 | } else if (nIndex == MT_CALLSTACK) { 845 | // TODO 846 | } else if (nIndex == MT_THREADS) { 847 | ui->widgetThreads->reload(); 848 | } else if (nIndex == MT_HANDLES) { 849 | // TODO 850 | } else if (nIndex == MT_MODULES) { 851 | ui->widgetProcessModules->reload(); 852 | } else if (nIndex == MT_SYMBOLS) { 853 | ui->widgetSymbols->reload(); 854 | } 855 | } 856 | 857 | void XDebuggerWidget::followInDisasm(XADDR nAddress) 858 | { 859 | // TODO memory manager 860 | // TODO aprox Address 861 | 862 | if (!XProcess::isAddressInMemoryRegion(&g_mrDisasm, nAddress)) { 863 | g_mrDisasm = XProcess::getMemoryRegionByAddress(g_pInfoDB->getCurrentMemoryRegionsList(), nAddress); 864 | 865 | XProcess *pProcessMemory = _getProcessMemory(g_mrDisasm.nAddress, g_mrDisasm.nSize); 866 | 867 | if (pProcessMemory) { 868 | // XBinary binary(pProcessMemory, true, g_mrDisasm.nAddress); 869 | // binary.setArch(g_osInfo.sArch); 870 | // binary.setMode(g_osInfo.mode); 871 | 872 | XDisasmView::OPTIONS disasmOptions = {}; 873 | disasmOptions.nInitAddress = nAddress; 874 | // disasmOptions.memoryMapRegion = binary.getMemoryMap(); 875 | disasmOptions.bAprox = true; 876 | ui->widgetDisasm->setData(pProcessMemory, disasmOptions, false); 877 | ui->widgetDisasm->setReadonly(false); 878 | } 879 | } else { 880 | ui->widgetDisasm->goToAddress(nAddress, true, true); 881 | } 882 | 883 | ui->widgetDisasm->setSelectionAddress(nAddress, 1); 884 | } 885 | 886 | void XDebuggerWidget::followInHex(XADDR nAddress) 887 | { 888 | if (!XProcess::isAddressInMemoryRegion(&g_mrHex, nAddress)) { 889 | g_mrHex = XProcess::getMemoryRegionByAddress(g_pInfoDB->getCurrentMemoryRegionsList(), nAddress); 890 | 891 | XProcess *pProcessMemory = _getProcessMemory(g_mrHex.nAddress, g_mrHex.nSize); 892 | 893 | if (pProcessMemory) { 894 | XHexView::OPTIONS hexOptions = {}; 895 | // hexOptions.nStartAddress = g_mrHex.nAddress; 896 | // hexOptions.nStartSelectionOffset = nAddress - hexOptions.nStartAddress; 897 | hexOptions.addressMode = XHexView::LOCMODE_ADDRESS; 898 | ui->widgetHex1->setData(pProcessMemory, hexOptions, false); // TODO Current 899 | ui->widgetHex1->setReadonly(false); // TODO Current 900 | } 901 | } else { 902 | ui->widgetHex1->goToAddress(nAddress); // TODO Current 903 | } 904 | 905 | ui->widgetHex1->setSelectionAddress(nAddress, 1); // TODO Current 906 | } 907 | 908 | void XDebuggerWidget::followInStack(XADDR nAddress) 909 | { 910 | #ifdef Q_OS_WIN 911 | XProcess::getCallStack(ui->widgetStack->getXInfoDB()->getProcessInfo()->hProcess, ui->widgetStack->getXInfoDB()->getProcessInfo()->hMainThread); 912 | #endif 913 | 914 | if (!XProcess::isAddressInMemoryRegion(&g_mrStack, nAddress)) { 915 | g_mrStack = XProcess::getMemoryRegionByAddress(g_pInfoDB->getCurrentMemoryRegionsList(), nAddress); 916 | 917 | XProcess *pProcessMemory = _getProcessMemory(g_mrStack.nAddress, g_mrStack.nSize); 918 | 919 | if (pProcessMemory) { 920 | XStackView::OPTIONS stackOptions = {}; 921 | stackOptions.nStartAddress = g_mrStack.nAddress; 922 | stackOptions.nCurrentAddress = nAddress; 923 | stackOptions.nCurrentStackPointer = nAddress; 924 | ui->widgetStack->setData(pProcessMemory, stackOptions, false); // TODO XInfoDB !!! 925 | ui->widgetStack->setReadonly(false); 926 | } 927 | } else { 928 | ui->widgetStack->setCurrentStackPointer(nAddress); 929 | ui->widgetStack->goToAddress(nAddress); 930 | } 931 | 932 | ui->widgetStack->setSelectionAddress(nAddress); 933 | } 934 | 935 | void XDebuggerWidget::on_toolButtonAnimateStepInto_clicked() 936 | { 937 | animateStepInto(); 938 | } 939 | 940 | void XDebuggerWidget::on_toolButtonAnimateStepOver_clicked() 941 | { 942 | animateStepOver(); 943 | } 944 | 945 | void XDebuggerWidget::on_toolButtonAnimateStop_clicked() 946 | { 947 | animateStop(); 948 | } 949 | 950 | void XDebuggerWidget::on_toolButtonTraceStepInto_clicked() 951 | { 952 | traceStepInto(); 953 | } 954 | 955 | void XDebuggerWidget::on_toolButtonTraceStepOver_clicked() 956 | { 957 | traceStepOver(); 958 | } 959 | 960 | void XDebuggerWidget::on_toolButtonTraceStop_clicked() 961 | { 962 | traceStop(); 963 | } 964 | 965 | // void XDebuggerWidget::memoryRegionsListChangedSlot() 966 | //{ 967 | // qDebug("void XDebuggerWidget::memoryRegionsListChangedSlot()"); 968 | 969 | // QList *pListMR = g_pInfoDB->getCurrentMemoryRegionsList(); 970 | 971 | // ui->comboBoxHexRegion->blockSignals(true); 972 | 973 | // ui->comboBoxHexRegion->clear(); 974 | 975 | // qint32 nNumberOfRecirds = pListMR->count(); 976 | 977 | // for (qint32 i = 0; i < nNumberOfRecirds; i++) { 978 | // QString sString = XProcess::memoryRegionToString(pListMR->at(i)); 979 | 980 | // ui->comboBoxHexRegion->addItem(sString); 981 | 982 | // // TODO 983 | // } 984 | 985 | // ui->comboBoxHexRegion->blockSignals(false); 986 | //} 987 | 988 | void XDebuggerWidget::modulesListChangedSlot() 989 | { 990 | // TODO change Threads 991 | qDebug("void XDebuggerWidget::modulesListChangedSlot()"); 992 | } 993 | 994 | void XDebuggerWidget::threadsListChangedSlot() 995 | { 996 | qDebug("void XDebuggerWidget::threadsListChangedSlot()"); 997 | } 998 | 999 | void XDebuggerWidget::registersListChangedSlot() 1000 | { 1001 | qDebug("void XDebuggerWidget::registersListChangedSlot()"); 1002 | updateWidget(MT_CPU); // TODO update if active or there are changes 1003 | } 1004 | 1005 | void XDebuggerWidget::updateWidget(MT mt) 1006 | { 1007 | // TODO Hashes 1008 | if (mt == MT_CPU) { 1009 | quint64 nInstructionPointer = g_pInfoDB->getCurrentInstructionPointerCache(); 1010 | quint64 nStackPointer = g_pInfoDB->getCurrentStackPointerCache(); 1011 | 1012 | // TODO Check tab 1013 | followInDisasm(nInstructionPointer); 1014 | followInStack(nStackPointer); 1015 | 1016 | ui->widgetRegs->reload(); 1017 | } 1018 | } 1019 | 1020 | void XDebuggerWidget::on_pushButtonCommandRun_clicked() 1021 | { 1022 | QString sCommand = ui->lineEditCommand->text(); 1023 | 1024 | XDebuggerConsole::COMMAND_RESULT commandResult = {}; 1025 | 1026 | XDebuggerConsole::commandControl(&commandResult, sCommand, g_pDebugger); 1027 | 1028 | qint32 nNumberOfTexts = commandResult.listTexts.count(); 1029 | qint32 nNumberOfErrors = commandResult.listErrors.count(); 1030 | 1031 | for (qint32 i = 0; i < nNumberOfTexts; i++) { 1032 | infoMessageSlot(commandResult.listTexts.at(i)); 1033 | } 1034 | 1035 | for (qint32 i = 0; i < nNumberOfErrors; i++) { 1036 | errorMessageSlot(commandResult.listErrors.at(i)); 1037 | } 1038 | 1039 | reload(); 1040 | } 1041 | 1042 | void XDebuggerWidget::addSymbolsSlot(const QString &sFileName, XADDR nImageBase) 1043 | { 1044 | #ifdef QT_DEBUG 1045 | qDebug("addSymbolsSlot %s >>>>>>>>>", sFileName.toUtf8().data()); 1046 | #endif 1047 | // g_pMutex->lock(); 1048 | 1049 | // DialogXInfoDBTransferProcess dialogTransfer(this); 1050 | 1051 | // XInfoDBTransfer::OPTIONS options = {}; 1052 | // options.sDatabaseFileName = sFileName; 1053 | // // options.bIsImage = false; 1054 | // // options.nModuleAddress = nImageBase; 1055 | // options.fileType = XBinary::FT_PE; 1056 | 1057 | // // dialogTransfer.setData(g_pInfoDB, XInfoDBTransfer::COMMAND_SYMBOLS, options); 1058 | 1059 | // dialogTransfer.showDialogDelay(); 1060 | 1061 | // g_pMutex->unlock(); 1062 | 1063 | #ifdef QT_DEBUG 1064 | qDebug("addSymbolsSlot %s <<<<<<<<<", sFileName.toUtf8().data()); 1065 | #endif 1066 | } 1067 | 1068 | void XDebuggerWidget::removeSymbolsSlot(const QString &sFileName) 1069 | { 1070 | #ifdef QT_DEBUG 1071 | qDebug("removeSymbolsSlot %s", sFileName.toUtf8().data()); 1072 | #endif 1073 | g_pMutex->lock(); 1074 | g_pMutex->unlock(); 1075 | } 1076 | --------------------------------------------------------------------------------