Skip to content

fix: debugging clients are now able to debug with debug-brk #4465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
this.$errors.fail("--release flag is not applicable to this command");
}

if (this.$options.hmr && this.$options.debugBrk) {
this.$errors.fail("--debug-brk and --hmr flags cannot be combined");
}

const minSupportedWebpackVersion = this.$options.hmr ? LiveSyncCommandHelper.MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR : null;
this.$bundleValidatorHelper.validate(minSupportedWebpackVersion);

Expand Down
2 changes: 1 addition & 1 deletion lib/common/definitions/mobile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ declare module Mobile {
}

interface IiOSDevice extends IDevice {
getDebugSocket(appId: string, projectName: string): Promise<any>;
getDebugSocket(appId: string, projectName: string, ensureAppStarted?: boolean): Promise<any>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean variable passed as param??? 🙀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a temp flag till 5.3.1 -> #4466

destroyDebugSocket(appId: string): Promise<void>;
openDeviceLogStream(options?: IiOSLogStreamOptions): Promise<void>;
destroyAllSockets(): Promise<void>;
Expand Down
7 changes: 5 additions & 2 deletions lib/common/mobile/ios/ios-device-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ export abstract class IOSDeviceBase implements Mobile.IiOSDevice {
abstract openDeviceLogStream(options?: Mobile.IiOSLogStreamOptions): Promise<void>;

@performanceLog()
public async getDebugSocket(appId: string, projectName: string): Promise<net.Socket> {
public async getDebugSocket(appId: string, projectName: string, ensureAppStarted: boolean = false): Promise<net.Socket> {
return this.$lockService.executeActionWithLock(
async () => {
if (this.cachedSockets[appId]) {
return this.cachedSockets[appId];
}

await this.attachToDebuggerFoundEvent(appId, projectName);
await this.applicationManager.startApplication({ appId, projectName });
if (ensureAppStarted) {
await this.applicationManager.startApplication({ appId, projectName });
}

this.cachedSockets[appId] = await this.getDebugSocketCore(appId);

if (this.cachedSockets[appId]) {
Expand Down
4 changes: 3 additions & 1 deletion lib/services/livesync/ios-device-livesync-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class IOSDeviceLiveSyncService extends DeviceLiveSyncServiceBase implemen

const appId = projectData.projectIdentifiers.ios;
try {
this.socket = await this.device.getDebugSocket(appId, projectData.projectName);
// TODO: temp workaround till we setup the sockets along with the app start
const ensureAppStarted = true;
this.socket = await this.device.getDebugSocket(appId, projectData.projectName, ensureAppStarted);
} catch (err) {
this.$logger.trace(`Error while connecting to the debug socket. Error is:`, err);
}
Expand Down