Add some information about debugging the updater authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame
......@@ -137,6 +137,9 @@ Setting a custom updater URL will also override the update certificate: copy you
If you are testing `release` or `alpha`, you will have to modify the `build` script to replace the release key instead of the nightly.
Since you are creating new builds for testing purposes, it is a good idea to add some code to help you to debug the updater binary.
See the troubleshooting section.
## Sign MAR file
```sh
......@@ -263,4 +266,39 @@ At this point, Firefox should find the update automatically, download it, and ap
### Troubleshooting
Updater logs can be enabled in the browser by setting `app.update.log` to `true`, and are visible in the JavaScript console.
\ No newline at end of file
#### Logs
Updater logs can be enabled in the browser by setting `app.update.log` to `true`, and are visible in the JavaScript console.
This helps to find deploy and/or download errors (e.g., wrong URL in the `config.yml`, unsigned mars etc...).
Errors that occurred during the update process are usually logged in `UpdateInfo/updates/last-update.log`.
#### Attaching a debugger
The `updater` process is started by Firefox, therefore it is very difficult to start it in a debugging environment.
There are a couple of workarounds that involve modify adding some code at the beginning of `NS_main` in `toolkit/mozapps/update/updater/updater.cpp`.
If you are on Windows, you can add a `__debugbreak();` line, and you will be able to attach the debugger.
However, if you can't debug it, there is no way to resume the updater.
A similar approach is to add some sleep, whose value depends on an environment variable.
For example, this will work on Windows:
```c++
const char *shouldDelay = getenv("TBB_UPDATER_DELAY");
if (shouldDelay) {
char *endptr;
long d = strtol(shouldDelay, &endptr, 10);
if (endptr == shouldDelay) {
d = 60;
}
Sleep(d * 1000);
}
```
For other platforms, you will need to change `Sleep` with something else (maybe `std::this_thread::sleep_for` will work).
At that point, you can define a number of seconds to sleep and let you attach the debugger by setting `TBB_UPDATER_DELAY` before running the Firefox process.
Luckily, Firefox will pass the environment variables to the updater process.
\ No newline at end of file