Skip to content

Commit

Permalink
[#58] Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Dainerx committed Dec 31, 2024
1 parent a6d8bb0 commit c3b79eb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,20 @@ Use `ocb --help` to learn about which flags are available.

## Debug

To keep the debug symbols in the resulting OpenTelemetry Collector binary, set the configuration property `debug_compilation` to true.
### Debug symbols

By default, the LDflags are set to -s -w, which strips debugging symbols to produce a smaller OpenTelemetry Collector binary. To retain debugging symbols and DWARF debugging data in the binary, override the LDflags as shown:

```console
ocb --ldflags=" " --config=builder-config.yaml.
```

### Debugging with Delve

To ensure the code being executed matches the written code exactly, debugging symbols must be preserved, and compiler inlining and optimizations disabled. You can achieve this in two ways:

1. Set the configuration property `debug_compilation` to true.
2. Manually override the ldflags and gcflags `ocb --ldflags=" " --gcflags="all=-N -l" --config=builder-config.yaml.`

Then install `go-delve` and run OpenTelemetry Collector with `dlv` command as the following example:

Expand Down

0 comments on commit c3b79eb

Please sign in to comment.