facebook / facebook/hermes

Strange hermes debug jumps and var state #23820

Open
#1,087 13 comments 4 reactions 0 assignees View on GitHub
bug debugging
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

### Minimal reproducible example

https://github.com/mgscreativa/heremes-test-expo-go

### Summary

I’m using hermes debugging working, but the debugger behaviour is really strange. My workspace is as follows:

- Linux Mint 21.2
- WebStorm 2023.1.4
- Using expo sdk v49 (49.0.6)
- Expo Go on iPhone 12 Pro Max and iOS 16.5.1

For testing hermes debugging I have created a complete new and clean app with `npx create-expo-app@latest --template tabs`, I have also uploaded the app to GitHub here [GitHub - mgscreativa/heremes-test-expo-go: heremes-test-expo-go 1](https://github.com/mgscreativa/heremes-test-expo-go)

Accessing chrome debugger by pressing **j** in terminal I can see the hermes instance running and also can browse the project files and set some breakpoints in code but the debugger behaviour is really strange, ie:

- Defined variables displays **undefined** when already defined in code
- Watched vars already defined in code, sometimes display **undefined** as values and sometimes displays their actual values

I have tested the same result in:
- Linux with expo go in Android 13 device, iOS iPhone XS Max, and Android emulator API 33
- Macos Android 13 device, iOS iPhone XS Max

Have attached a two videos showing the process I’m following
#### Linux, Android Emu API 33
![Peek 2023-08-04 12-16](https://github.com/expo/expo/assets/1286632/84230ff3-4006-42c9-93be-d9dd0977917f)

#### Linux, iOS expo go
![Peek 2023-08-04 12-21ios](https://github.com/expo/expo/assets/1286632/02a226fb-ac04-4102-9ce2-51503dc51072)

#### Production code project
In this third video I'm showing the behaviour I get using a more complex project that I'm working on. I'll describe the strange behaviour:

- The debugger jumps directly to the code at line 58 without stopping on first breakpoint at line 52!
- Strangely, it jumps to line 64 but that line should not be executed as it's an else statement that was not hit by the condition of the if statement at line 58
- After hitting the Resume button, the code jumps to line 52 and it doesn't hit line 58 anymore
- Sometimes after hitting the Resume button the app crashes

![Peek 2023-08-04 12-53-3](https://github.com/expo/expo/assets/1286632/87633830-c271-4cc8-8837-efe2886fc887)

What Am I doing wrong? Should I configure anything else?

PS: Flipper 0.210.0 has the same behavior, tested on macos

### Environment

expo-env-info 1.0.5 environment info:
System:
OS: Linux 5.15 Linux Mint 21.2 (Victoria)
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.1/bin/yarn
npm: 9.8.1 - ~/.nvm/versions/node/v16.13.1/bin/npm
Watchman: 20230430.125247.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 33
Build Tools: 30.0.3, 33.0.0
System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86_64 Atom, android-32 | Google APIs Intel x86_64 Atom, android-33 | Google APIs Intel x86_64 Atom
npmPackages:
expo: ~49.0.5 => 49.0.6
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.72.3 => 0.72.3
react-native-web: ~0.19.6 => 0.19.7
npmGlobalPackages:
eas-cli: 3.18.3
expo-cli: 6.3.10
Expo Workflow: managed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.