Added disassembly function
This commit is contained in:
parent
9b0422f0c5
commit
e3520d91ee
|
@ -18,11 +18,15 @@ class ASBuilder {
|
|||
termination = NSNotificationCenter.defaultCenter().addObserverForName(NSTaskDidTerminateNotification,
|
||||
object: nil, queue: nil, usingBlock:
|
||||
{ (notification: NSNotification!) in
|
||||
if notification.object as? NSTask == self.task && self.task!.terminationStatus == 0 {
|
||||
if notification.object as? NSTask == self.task {
|
||||
if self.task!.terminationStatus == 0 {
|
||||
if let cont = self.continuation {
|
||||
self.continuation = nil
|
||||
cont()
|
||||
}
|
||||
} else {
|
||||
self.continuation = nil
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -121,4 +125,23 @@ class ASBuilder {
|
|||
task!.arguments = args;
|
||||
task!.launch()
|
||||
}
|
||||
|
||||
func disassembleProject(board: String) {
|
||||
task = NSTask()
|
||||
task!.currentDirectoryPath = dir.path!
|
||||
task!.launchPath = "/usr/local/CrossPack-AVR/bin/avr-objdump"
|
||||
|
||||
let fileManager = NSFileManager.defaultManager()
|
||||
let logURL = dir.URLByAppendingPathComponent("build/disasm.log")
|
||||
fileManager.createFileAtPath(logURL.path!, contents: NSData(), attributes: nil)
|
||||
let logOut = NSFileHandle(forWritingAtPath: logURL.path!)!
|
||||
task!.standardOutput = logOut
|
||||
task!.standardError = logOut
|
||||
|
||||
var args = ["-d", "-S", "build/"+board+"/"+dir.lastPathComponent+".elf"]
|
||||
let cmdLine = task!.launchPath+" "+(args as NSArray).componentsJoinedByString(" ")+"\n"
|
||||
logOut.writeData(cmdLine.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)!)
|
||||
task!.arguments = args;
|
||||
task!.launch()
|
||||
}
|
||||
}
|
|
@ -203,6 +203,7 @@ class ASFileTree : NSObject, NSOutlineViewDataSource {
|
|||
var dir = NSURL()
|
||||
var buildLog = ASLogNode(name: "Build Log", path: "build/build.log")
|
||||
var uploadLog = ASLogNode(name: "Upload Log", path: "build/upload.log")
|
||||
var disassembly = ASLogNode(name: "Disassembly", path: "build/disasm.log")
|
||||
|
||||
func addFileURL(url: NSURL, omitUnknown: Bool = true) {
|
||||
let type = ASFileType.guessForURL(url)
|
||||
|
@ -230,7 +231,7 @@ class ASFileTree : NSObject, NSOutlineViewDataSource {
|
|||
// MARK: Outline Data Source
|
||||
func outlineView(outlineView: NSOutlineView, numberOfChildrenOfItem item: AnyObject?) -> Int {
|
||||
if item == nil {
|
||||
return 3
|
||||
return 4
|
||||
} else {
|
||||
return (item as ASFileGroup).children.count
|
||||
}
|
||||
|
@ -242,6 +243,8 @@ class ASFileTree : NSObject, NSOutlineViewDataSource {
|
|||
return buildLog
|
||||
case 2:
|
||||
return uploadLog
|
||||
case 3:
|
||||
return disassembly
|
||||
default:
|
||||
return root
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
|||
updateChangeCount(.ChangeDone)
|
||||
}
|
||||
func outlineView(outlineView: NSOutlineView, willDisplayCell cell: AnyObject, forTableColumn tableColumn: NSTableColumn?, item: AnyObject) {
|
||||
if item === files.root || item === files.buildLog || item === files.uploadLog {
|
||||
if item === files.root || item === files.buildLog || item === files.uploadLog || item === files.disassembly {
|
||||
(cell as NSCell).font = NSFont.boldSystemFontOfSize(13.0)
|
||||
} else {
|
||||
(cell as NSCell).font = NSFont.systemFontOfSize(13.0)
|
||||
|
@ -476,5 +476,13 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate {
|
|||
}
|
||||
buildProject(sender)
|
||||
}
|
||||
|
||||
@IBAction func disassembleProject(sender: AnyObject) {
|
||||
builder.continuation = {
|
||||
self.selectNodeInOutline(self.files.disassembly)
|
||||
self.builder.disassembleProject(self.board)
|
||||
}
|
||||
buildProject(sender)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7096" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7096" systemVersion="14C82" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7096"/>
|
||||
</dependencies>
|
||||
|
@ -109,6 +109,11 @@
|
|||
<action selector="buildProject:" target="-1" id="Rkc-yl-Vwi"/>
|
||||
</connections>
|
||||
</toolbarItem>
|
||||
<toolbarItem implicitItemIdentifier="8F4A4234-688B-4341-96E1-BEE9BB98AF4B" label="Disasm" paletteLabel="Disassemble" tag="-1" image="DisassIcon" id="MP9-gL-Y3I">
|
||||
<connections>
|
||||
<action selector="disassembleProject:" target="-2" id="idL-cS-KK9"/>
|
||||
</connections>
|
||||
</toolbarItem>
|
||||
<toolbarItem implicitItemIdentifier="2B98B0B2-C192-4A20-9C17-8CDBD6A9002F" label="Clean" paletteLabel="Clean" tag="-1" image="CleanIcon" id="lGv-lT-Eh9">
|
||||
<connections>
|
||||
<action selector="cleanProject:" target="-1" id="LzL-6C-IDi"/>
|
||||
|
@ -198,6 +203,7 @@
|
|||
<defaultToolbarItems>
|
||||
<toolbarItem reference="2cP-cC-Cr8"/>
|
||||
<toolbarItem reference="69r-aN-6vG"/>
|
||||
<toolbarItem reference="MP9-gL-Y3I"/>
|
||||
<toolbarItem reference="FYt-ZW-Epr"/>
|
||||
<toolbarItem reference="lGv-lT-Eh9"/>
|
||||
<toolbarItem reference="FYt-ZW-Epr"/>
|
||||
|
@ -218,6 +224,7 @@
|
|||
<resources>
|
||||
<image name="BuildIcon" width="32" height="32"/>
|
||||
<image name="CleanIcon" width="32" height="32"/>
|
||||
<image name="DisassIcon" width="32" height="32"/>
|
||||
<image name="UploadIcon" width="32" height="32"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
22
AVRsack/Images.xcassets/DisassIcon.imageset/Contents.json
vendored
Normal file
22
AVRsack/Images.xcassets/DisassIcon.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x",
|
||||
"filename" : "DisassIcon 1x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"filename" : "DisassIcon 2x.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
AVRsack/Images.xcassets/DisassIcon.imageset/DisassIcon 1x.png
vendored
Normal file
BIN
AVRsack/Images.xcassets/DisassIcon.imageset/DisassIcon 1x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
AVRsack/Images.xcassets/DisassIcon.imageset/DisassIcon 2x.png
vendored
Normal file
BIN
AVRsack/Images.xcassets/DisassIcon.imageset/DisassIcon 2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
BIN
Artwork/DisassIcon.artx/Preview/preview.png
Normal file
BIN
Artwork/DisassIcon.artx/Preview/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
BIN
Artwork/DisassIcon.artx/QuickLook/Preview.pdf
Normal file
BIN
Artwork/DisassIcon.artx/QuickLook/Preview.pdf
Normal file
Binary file not shown.
BIN
Artwork/DisassIcon.artx/doc.thread
Normal file
BIN
Artwork/DisassIcon.artx/doc.thread
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user