Giter Site home page Giter Site logo

bowlerhatllc / vscode-swf-debug Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 3.0 788 KB

SWF debugger extension for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=bowlerhatllc.vscode-swf-debug

License: Apache License 2.0

TypeScript 11.05% JavaScript 0.68% Java 88.26%
visual-studio-code swf debug-adapter-protocol adobe-air adobe-flash flash air debugger vscode

vscode-swf-debug's Introduction

SWF Debugger for Visual Studio Code

This README file is intended for contributors to the extension. If you simply want to install the latest stable version of the extension, please visit the Visual Studio Marketplace. For help using the extension, visit the vscode-as3mxml wiki for detailed instructions.

Modules

This project is divided into several modules.

  1. swf-debug-adapter provides SWF debugging for Visual Studio Code and other editors that support the Debug Adapter Protocol. This module is written in Java.

  2. vscode-extension implements various features that are specific to Visual Studio Code, and initializes the various Java processes (like swf-debugger). This module is written in TypeScript.

  3. distribution packages everything together to create the final extension that is compatible with Visual Studio Code.

Build instructions

Requires JDK 8 (or newer), Apache Maven and Node.js. Run the following command in the root directory to build the extension:

mvn clean package

The extension will be generated in distribution/target/vscode-swf-debug/vscode-swf-debug. This directory may be run inside Visual Studio Code's extension host. Additionally, a .vsix file will be generated that may be manually installed in Visual Studio Code.

Support this project

The SWF Debugger for Visual Studio Code is developed by Josh Tynjala with the support of community members like you.

Support Josh Tynjala on Patreon

Special thanks to the following sponsors for their generous support:

vscode-swf-debug's People

Contributors

dependabot[bot] avatar joshtynjala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-swf-debug's Issues

Missing "program" path when renaming asconfig.json

When I hit F5, I get the following error pop-up:
Missing "program" path for SWF debug configuration. Must be a .swf file or an Adobe AIR application descriptor.

I've resolved the issue, but I believe it is a bug.

I have three asconfigs:
asconfig.develop.json
asconfig.release.json (bundle)
asconfig.steam.json (native)

If I rename asconfig.develop.json to asconfig.json F5 functions again.

Cannot inspect local constants at runtime

We use local const declarations to clearly show intent of what locals can and cannot be overriden in scope.
However, const locals do not show up in the debug locals, and cannot be evaluated at runtime when paused on a breakpoint in the same scope.

This is problematic since we would be stuck using var mostly everywhere.

debug error when I set breakpoint

error while processing request 'setBreakpoints'
java.nio.file.InvalidPathException: Illegal char <:> at index 27: AppBazaar_fla.Symbol105_423::frame1
	at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
	at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
	at java.nio.file.Paths.get(Paths.java:84)
	at com.as3mxml.vscode.SWFDebugSession.setBreakpoints(SWFDebugSession.java:993)
	at com.as3mxml.vscode.SWFDebugSession.setBreakpoints(SWFDebugSession.java:977)
	at com.as3mxml.vscode.debug.DebugSession.dispatchRequest(DebugSession.java:160)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.dispatch(ProtocolServer.java:143)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.processData(ProtocolServer.java:102)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.start(ProtocolServer.java:81)
	at com.as3mxml.vscode.SWFDebug.main(SWFDebug.java:49)

I didn't have this issue, but recenty I see this error for all of my projects !
My vscode version: 1.44.2

{
"version": "0.2.0",
"configurations": [
{
"type": "swf",
"request": "launch",
"name": "Debug (desktop)",
"profile": "mobileDevice",
"screensize": "iPhoneRetina",
"screenDPI": 326,
"versionPlatform": "WIN",
"program": "bin/AppBazaar-app.xml",
"preLaunchTask": "Adobe Animate: compile debug - AppBazaar.fla"
}
]
}

Invalid variable attributes

When I debug flash application with flashplayerdebugger, it shows some variables, properties as "Invalid variable attributes". I use Debugger for SWF 1.0.1, on both Linux (debugger run on same computer), and Mac (mac remote to Linux).

Screen Shot 2019-12-25 at 23 10 45

Breakpoints not hit when debugging Adobe Air Desktop app

First of all, sorry for raising this as an issue. It's more like a question / help needed kind of topic.

The problem

I have just setup my first Adobe AIR Desktop app and I am running into trivial issue when debugging - my breakpoints are not getting hit. I am able to set the breakpoints just fine, they are not flagged as unverified.

Debug traces are correctly appearing in VS Code's Debug Console terminal. I also tried throwing an Exception in the code and this caused debugger to correctly break the program flow and I am also able to inspect the variables so my guess is that debugger is working just fine. Check this out:
image

Following the documentation

While setting my dev environment up, I walked through following documentation (which is very well written and detailed btw). I think that I have configured everything properly:

Setup

Visual Studio Code version is 1.43.1.

Installed Adobe AIR SDK is Adobe AIR SDK & Compiler (version 32.0.0.116 for Win & Mac).

Installed extensions are:

Configuration files

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "swf",
            "request": "launch",
            "name": "Launch SWF",
            "preLaunchTask": "ActionScript: compile debug - asconfig.json",
            //"program": "${workspaceFolder}/bin/Main.swf"
        }
    ]
}

asconfig.json

{
	"config": "air",
	"compilerOptions": {
		"source-path": [
			"src"
		],
		"output": "bin/Main.swf"
	},
	"mainClass": "Main",
	"application": "src/Main-app.xml"
}

Main-app.xml

<?xml version="1.0" encoding="utf-8" ?>
<application xmlns="http://ns.adobe.com/air/application/32.0">
	<id>com.example.Main</id>
	<versionNumber>0.0.0</versionNumber>
	<filename>Main</filename>
	<name>Main</name>
	<initialWindow>
		<content>[Path to content will be replaced by Visual Studio Code]</content>
		<visible>true</visible>
	</initialWindow>
</application>

Any ideas why this happens? Thanks!

Support AIR ADT simulator argument in launch.json

From Daniel Sperl:

... as for the icing on the cake, or if you're looking for ideas for a future update (haha), one small but useful addition would be to add a property that allows choosing the device to be simulated. Harman recently added the simulator parameter to adt recently, to be used like this: -simulator "iPhone 8". That way, one wouldn't need to rely on the environment variable any longer.

But, again, that's just a small nice-to-have idea for the future – it's FANTASTIC to be able to run the simulator like that, as it is. Thanks again! 😁

Source: #30 (comment)

Launch on Android device fails

I am trying to import our company Air Mobile project from Flash Builder over to vscode, and I have been able to use the import tool to set it up, compile, and debug on the simulator for both iOS and Android, however, trying to debug on device for Android fails to install with status code 14, if the app is already installed on the device. I can uninstall the app and the install works fine. I read on some of the other issues that air tool should uninstall on each launch, but that does not seem to be working for me. Even when I do uninstall the app and try to debug, the task fails on Launch with the same error code. I have tried this with multiple devices and it fails on all of them.

AIR SDK version: 33.1.1.533
Java version: 1.8.0_301 x64

Wrong line highlighting during debugging

Sometimes the as3mxml extension incorrectly highlight the line where exception occured. Please view the video bellow for more detail.

IncorrectLineHighlighting.mp4

The line 1327 should be highlighted instead of line 1322.

I think the issue related to the is keyword of the line 1322. I faced similar issues for several times and I remember that every time it happens, the line that contains is keyword is highlighted instead of the correct line.

Thanks!

Using multi-root workspace with launch configurations in .code-workspace instead of launch.json, Launch SWF fails: `Cannot read property 'uri' of undefined`

I get the following error pop-up to use SWF debugger for multi-root workspace.

Cannot read property 'uri' of undefined

Project structure

project1/
  test.swf
project2/
  ...
workspace.code-workspace

workspace.code-workspace

{
  "folders": [
    {
      "path": "project1"
    },
    {
      "path": "project2"
    }
  ],
  "launch": {
    "configurations": [
      {
        "name": "Launch SWF",
        "type": "swf",
        "request": "launch",
        "program": "${workspaceFolder:project1}/test.swf"
      }
    ]
  }
}

Environment

vscode version: 1.58.2
OS: Windows 10

Set environment variables when launching Adobe AIR app

Hi, I'm attempting to launch a shell command before debugging my game on Steam. I've tried creating a preLaunchTask like this:

{ "label": "export_steam_libs", "command": "export DYLD_FALLBACK_LIBRARY_PATH=$STEAM_SDK/redistributable_bin/osx32", "type": "shell" }

And using it as a preLaunchTask but it doesn't seem to work.
On the other hand, if I launch the game via adl in command line by doing the following it does work:

export DYLD_FALLBACK_LIBRARY_PATH=$STEAM_SDK/redistributable_bin/osx32 /Users/workspaceAIR/_SDKS/air_29/bin/adl /Users/workspaceAIR/Game/bin/MainGame-app.xml /Users/workspaceAIR/Game/bin/ -extdir /Users/workspaceAIR/Game/anes/steam/ -profile extendedDesktop

I've also tried using runtimeArgs:

{
            "type": "swf",
            "request": "launch",
            "name": "Launch Steam",
            "profile": "extendedDesktop",
            "extdir": "../../workspaceAIR/Game/anes/steam",
            "runtimeArgs": ["export DYLD_FALLBACK_LIBRARY_PATH=$STEAM_SDK/redistributable_bin/osx32"],
        }

But doesn't work either. Any help on how can I achieve this would be appreciated.
Thanks!

preLaunchTask > task not found

I'm using custom build tasks, and spent quite some time figuring out why preLaunchTask wasn't working for me, it would complain that it couldn't find the task.

The problem was that both the "launch" and "task" needs to be at the same "level" (either both defined at the "workspace" level or both at the "directory" level). In other words: either both should be defined in the XX.code-workspace file, or both as .vscode/{tasks,launch}.json.

That's for the record.

It might be worth mentioning in some way in the readme, also that the value in "preLaunchTask" corresponds to the "label" in the custom task.

BreakPoints get error

error while processing request '{_request}'{_exception}

When debugger and add a breakPoint, I will get this error , the breakPoint is not working.

SWF debugger: can not work with flexmojos

Hi~
I have a project compiled with flexmojos-maven-plugin. But it seems like that the as3mxml swf debuger can not work with the maven plugin. When I start debug the state bar of VS Code just turns yellow from bule but nothing happend. I keep waiting for almost 15min, there is no output. When compile the project with as3mxml extension, the debuger works fine. So I wanna know is swf debugger support flexmojos-maven-plugin? Or what can I do to find out what was happing when the swf debugger has no response.
my lanch.json is here :

{
  "version":"swf",
  "request":"launch",
  "name":"Lanch AIR desktop",
  "exdir":"unpacked-anes"
}

I manually unpacked all .ane files and put them in unpacked-anes folder.

How to debug a swc library?

I have a air library project comiled as a swc file. In my another project that uses the swc file as a library, when debugging into code inside the swc, it will show the following message in vscode,

vscode_screenshot

My question is: How do I debug into the code inside of the swc file? or Can I attach the source code of that swc to the Debuger?

Cannot debug on iOS Simulator

Hey Josh,

I just tried to get a project to launch in the iOS simulator, but I just can't get it to work. Perhaps you've got an idea what I'm doing wrong?

Packaging seems to be working fine. I added the following configuration to asconfig.json:

"ios_simulator": {
    "output": "bin/Main-Simulator.ipa",
    "platformsdk": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk",
    "signingOptions": {
        "storetype": "pkcs12",
        "keystore": "path/to/dev_certificate.p12",
        "provisioning-profile": "path/to/ios_dev_profile.mobileprovision"
    }
}

When I build this, I get an IPA that I can install manually on the simulator like this:

adt -installApp -platform ios -platformsdk /Applications/Xcode.app/[...]/iPhoneSimulator14.5.sdk -device ios-simulator -simulator "iPhone 8" -package Main-Simulator.ipa

Since this is working, I guess that I set up packaging correctly.
Then I set up a launch configuration like this:

{
    "type": "swf",
    "request": "attach",
    "name": "Launch on iOS Simulator",
    "platform": "ios",
    "connect": true,
    "preLaunchTask": "Adobe AIR: package iOS simulator debug - asconfig.json"
}

(BTW, it would be great to have the simulator option here that Harman recently introduced.)

When I launch this, I receive the empty VSCode error box that allows me to open 'launch.json', and the debug console says:

Device uninstall failed for platform "ios" and application ID "com.gamua.vscode" with status code 15.

I tried it on a different Mac, as well, and there I got status code 14 instead. Not much better. 😉

Do you have any idea what I could check? I'm using the latest stable AIR SDK (33.1.1.476), and have VSCode, macOS (11.4 on Intel) and Xcode in their latest versions.

Thanks a lot in advance, my friend!

Debugger error when adding breakpoints to SWC component

Hi, @joshtynjala
first of all, thanks for this great extension. I'm trying to use it but I'm facing some issues when I run the project to debug. I've read all created issues in your repo but I've found no solution that works in my case.

So, I have 3 root folders in my saved workspace:

  • A project with components that builds a SWC file.
  • A Flex project that uses the SWC component and builds a SWF file.
  • And an Air desktop project that also uses the SWC components, but when this Air project runs it just loads the Flex SWF file (I mentioned at previous item) from an external host (this.ByteLoader.load(new URLRequest("http://localhost/myFlex.swf"))).

I know it may seems an unusual structure, but it's a legacy project and it runs fine on Eclipse/Flash Builder.

I already be able to make those 3 builds (compile debug mode) and run the Air project by your extension, but when I try to create a breakpoint in the Flex or SWC project, the follow error appears:

Exception in debugger: flash.tools.debugger.InProgressException
	at flash.tools.debugger.concrete.DSwfInfo.swdLoaded(DSwfInfo.java:162)
	at flash.tools.debugger.concrete.DSwfInfo.getSourceList(DSwfInfo.java:137)
	at flash.tools.debugger.threadsafe.ThreadSafeSwfInfo.getSourceList(ThreadSafeSwfInfo.java:84)
	at com.as3mxml.vscode.SWFDebugSession.setBreakpoints(SWFDebugSession.java:1012)
	at com.as3mxml.vscode.SWFDebugSession.setBreakpoints(SWFDebugSession.java:996)
	at com.as3mxml.vscode.debug.DebugSession.dispatchRequest(DebugSession.java:160)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.dispatch(ProtocolServer.java:143)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.processData(ProtocolServer.java:102)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.start(ProtocolServer.java:81)
	at com.as3mxml.vscode.SWFDebug.main(SWFDebug.java:49)

The breakpoints just work if they were created in Air project (the only that has de launch.json configured).

Please, could you help me to find out how to solve this?

Thanks in advance.

Exceptions occur when debugging mobile devices over wifi

I'm using your extension to debug Adobe AIR on iPhones over wifi, using the attach launch parameter. When debugging I will sometimes hit the default 750ms timeout when using the step functionality. It looks like this can be configured in the SessionManager class. Could you expose this in the launch parameters in the future or increase this to be several seconds in length? Also, non-fatal handling of this or other errors would be great.

Here's the exception I get which kills the connection:
Exception in debugger: flash.tools.debugger.NoResponseException: Timeout occurred while waiting for debugging response from Flash Player for 750 milliseconds at flash.tools.debugger.concrete.PlayerSession.stepOverWorker(PlayerSession.java:2960) at flash.tools.debugger.concrete.PlayerSession.stepOver(PlayerSession.java:833) at flash.tools.debugger.threadsafe.ThreadSafeSession.stepOver(ThreadSafeSession.java:241) at com.as3mxml.vscode.SWFDebugSession.next(SWFDebugSession.java:971) at com.as3mxml.vscode.debug.DebugSession.dispatchRequest(DebugSession.java:114) at com.as3mxml.vscode.debug.protocol.ProtocolServer.dispatch(ProtocolServer.java:143) at com.as3mxml.vscode.debug.protocol.ProtocolServer.processData(ProtocolServer.java:102) at com.as3mxml.vscode.debug.protocol.ProtocolServer.start(ProtocolServer.java:81) at com.as3mxml.vscode.SWFDebug.main(SWFDebug.java:49)

Thanks!

Unable to launch debug session for Flash SWF on Linux

After recent updates, I can't use launch debug session for SWF on Linux anymore.

Here my launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "swf",
      "request": "attach",
      "name": "Attach SWF",
    },
    {
        "type": "swf",
        "request": "launch",
        "name": "Launch SWF",
        "runtimeExecutable": "/usr/bin/flashplayerdebugger",
        "program": "out/index.swf"
    }
  ]
}

It says: "Error launching SWF debug session." even I run with runtimeExecutable param or not (I made it default program for the .swf). attach method still works fine, but I have to run flashplayerdebugger from terminal manually

error while processing request 'setBreakpoints'

happens when i place or remove any breakpoint
in launch.json i just attached to debugger v. 32.0.344

error while processing request 'setBreakpoints' java.lang.NullPointerException at 
com.as3mxml.vscode.SWFDebugSession.setBreakpoints(SWFDebugSession.java:997) at 
com.as3mxml.vscode.SWFDebugSession.setBreakpoints(SWFDebugSession.java:985) at 
com.as3mxml.vscode.debug.DebugSession.dispatchRequest(DebugSession.java:160) at 
com.as3mxml.vscode.debug.protocol.ProtocolServer.dispatch(ProtocolServer.java:143) at 
com.as3mxml.vscode.debug.protocol.ProtocolServer.processData(ProtocolServer.java:102) at 
com.as3mxml.vscode.debug.protocol.ProtocolServer.start(ProtocolServer.java:81) at 
com.as3mxml.vscode.SWFDebug.main(SWFDebug.java:49)

Cannot add specific ANE in sub-asconfig

Hi Josh,

I cannot figure out how to add a specific ANE only for an asconfig extension.

The ANE configuration works fine if I add it in the global asconfig.json:

{
	"config": "air",
	"mainClass": "Main",
	"compilerOptions": {
		"library-path": [
			"lib",
			"ane/com.gameanalytics.sdk.ane"
		],
		"source-path": [
			"src"
		]
	}
	"airOptions": {
		"extdir": [ "ane" ]
	}
}

But I got the following error when adding it only in the asconfig.desktop.json:

ane-issue

asconfig.json

{
	"config": "air",
	"mainClass": "Main",
	"compilerOptions": {
		"library-path": [
			"lib"
		],
		"source-path": [
			"src"
		]
	}
}

asconfig.desktop.json

{
	"extends": "asconfig.json",
	"compilerOptions": {
		"library-path": [
			"lib",
			"ane/com.gameanalytics.sdk.ane"
		]
	},
	"application": "application-desktop.xml",
	"airOptions": {
		"extdir": [ "ane" ]
	}
}

error while processing request 'evaluate'

This error occured during my debugging:

image

error while processing request 'evaluate'
java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
	at org.apache.royale.utils.CheapArray.get(CheapArray.java:133)
	at org.apache.royale.compiler.internal.tree.as.TreeNode.getChild(TreeNode.java:67)
	at flash.tools.debugger.expression.DebuggerUtil.parseExpression(DebuggerUtil.java:71)
	at flash.tools.debugger.expression.ASTBuilder.parse(ASTBuilder.java:136)
	at com.as3mxml.vscode.SWFDebugSession.evaluate(SWFDebugSession.java:1960)
	at com.as3mxml.vscode.debug.DebugSession.dispatchRequest(DebugSession.java:168)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.dispatch(ProtocolServer.java:143)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.processData(ProtocolServer.java:102)
	at com.as3mxml.vscode.debug.protocol.ProtocolServer.start(ProtocolServer.java:81)
	at com.as3mxml.vscode.SWFDebug.main(SWFDebug.java:49)

Launch task "attach android" fails

I get an error when trying to execute the following launch task:

{
  "type": "swf",
  "request": "attach",
  "applicationID": "my.app.id",
  "name": "Attach SWF (Android)",
  "platform": "android",
  "profile": "mobileDevice",
  "connect": true,
  "preLaunchTask": "Adobe AIR: package Android debug - asconfig-mobile.json"
}

Screen Shot 2021-10-19 at 09 55 24

I've tried many different things but can't figure out where the problem comes from.

Any way I can access some logs?

Debugging: display value in tooltip when hovering over variables

When debugging and pausing or hitting a breakpoint, when hovering the mouse over a variable, one would expect to see the value.

This currently seems to only work for parameters in a method. Any instance attribute values or local variables do not display the callout with the value, one has to use the tree view on the left, which is quite tedious.

Is this something you can fix? Is my setup incorrect?

Thanks for your help

Terminating Worker thread crashes the debugger/app

I assume this has something to do with how you're keeping track of the running threads in vscode and when one is terminated the whole app exits. I discovered this by testing my app with FlashDevelop where I'm terminating and restarting a background worker and it works as expected.

Kenny

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.