Skip to content

Commit

Permalink
Support GUI of dumpParser
Browse files Browse the repository at this point in the history
Using tkinter, this python script set arguments of dumpPaser
and redirect them to dumpParser.py
  • Loading branch information
junmin-kim committed Dec 22, 2017
1 parent 280d690 commit 3af4564
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 1 deletion.
30 changes: 29 additions & 1 deletion docs/HowToUseRamdump.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,41 @@ copying ramdump_0x02020000_0x0210c800.bin to $TIZENRT_BASEDIR/build/output/bin
```

## Ramdump Parsing Steps
DumpParser Script privodes two interfaces: CUI and GUI

### DumpParser using CUI
1. Run Ramdump Parser Script
```
cd $TIZENRT_BASEDIR/tools/ramdump/
python dumpParce.py -r $TIZENRT_BASEDIR/build/output/bin/ramdump_0x02020000_0x0210c800.bin -e $TIZENRT_BASEDIR/build/output/bin/tinyara -g 0
```
2. See the Output

### DumpParser using GUI
The UI configuration of DumpParser is as follows

| (X) (-) | Dump Parser | |
| ----------------- |:---------------------:| ------:|
| ELF path | `<Your ELF path>` | Browse |
| (O) AssertLog | | |
| (O) AssertLogFile | | |
| (O) Ramdump | | |
| Ramdump path | `<Your Ramdump path>` | Browse |
| Run DumpParser | | |

1. Run GUI Ramdump Parser Script
```
cd $TIZENRT_BASEDIR/tools/ramdump/
python gui_dumpParser.py
```

2. Browse ELF path
3. Select Ramdump mode
4. Browse Ramdump path
5. Click `Run DumpParser` button
6. See the Output

2. Example Call Stack Output
### Example Call Stack Output
```
********************************************************************
Board Crashed at :
Expand Down
132 changes: 132 additions & 0 deletions tools/ramdump/gui_dumpParser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#!/usr/bin/env python
###########################################################################
#
# Copyright 2017 Samsung Electronics All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
#
###########################################################################
# File : gui_dumpParser.py
# Description:
# graphical user interface of dumpParser.
# Real parsing is operated at dumpParser.py
from Tkinter import *
import tkFileDialog
import os
import tempfile

modes = (
("AssertLog",1),
("AssertLogFile",2),
("Ramdump",3),
)

g_elfpath = "../../build/output/bin/tinyara"

class PathFrame(Frame):
def __init__(self, parent, labelname="path", path=None):
Frame.__init__(self, parent)
self.path = StringVar()
self.path.set(path)
self.labelname = labelname
self.initialize()

def initialize(self):
self.label = Label(self, text=self.labelname)
self.label.grid(column=0, row=0, sticky="EW")
self.entry = Entry(self, textvariable=self.path)
self.entry.grid(column=1, row=0, sticky="EW")
self.entry.bind("<Return>", self.OnPressEnter)
btn = Button(self, text="Browse", command=self.OnButtonClick)
btn.grid(column=2, row=0)

def OnButtonClick(self):
temp = tkFileDialog.askopenfilename(parent=self)
if len(temp) > 0:
self.path.set(temp)

def OnPressEnter(self,event):
self.path.set(self.entry.get())

class DumpParser(Tk):
def __init__(self):
Tk.__init__(self)
self.modevar = IntVar()
self.modevar.set(1)
self.log = StringVar()
self.initialize()

def initialize(self):
self.elfpath = PathFrame(self, "ELF path ", g_elfpath)
self.elfpath.pack(anchor=W)

self.modeframe = Frame(self)
self.modeframe.pack(anchor=W)
for mode, val in modes:
Radiobutton(self.modeframe, text=mode, variable=self.modevar, value=val, command=self.OnRadioClick).pack(anchor=W)

self.dataframe = Frame(self)
self.dataframe.pack(anchor=W)
self.logtext = Text(self.dataframe)
self.logtext.pack(anchor=W)
self.logpath = PathFrame(self.dataframe, "AssertLogFile path")
self.ramdumppath = PathFrame(self.dataframe, "Ramdump path ")

btn = Button(self, text="Run DumpParser", command=self.RunDumpParser)
btn.pack(anchor=W)

def OnRadioClick(self):
self.logtext.pack_forget()
self.logpath.pack_forget()
self.ramdumppath.pack_forget()
if self.modevar.get() == 1:
self.logtext.pack(anchor=W)
elif self.modevar.get() == 2:
self.logpath.pack(anchor=W)
elif self.modevar.get() == 3:
self.ramdumppath.pack(anchor=W)

def RunDumpParser(self):
resWin = Toplevel(self)
resWin.wm_title("Dump Information")
resText = Text(resWin)
resText.pack()
if self.modevar.get() == 1:
fd, path = tempfile.mkstemp()
try:
with os.fdopen(fd, 'w') as tmp:
tmp.write(self.logtext.get("1.0",END))
with os.popen("python dumpParser.py" +
" -e " + self.elfpath.path.get() +
" -t " + path) as fd:
output = fd.read()
resText.insert(INSERT, output)
finally:
os.remove(path)
elif self.modevar.get() == 2:
with os.popen("python dumpParser.py"
" -e " + self.elfpath.path.get()+
" -t " + self.logpath.path.get()) as fd:
output = fd.read()
resText.insert(INSERT, output)
elif self.modevar.get() == 3:
with os.popen("python dumpParser.py"
" -e " + self.elfpath.path.get()+
" -r " + self.ramdumppath.path.get()) as fd:
output = fd.read()
resText.insert(INSERT, output)

if __name__ == "__main__":
app = DumpParser()
app.title("Dump Parser")
app.mainloop()

0 comments on commit 3af4564

Please sign in to comment.