xref: /aosp_15_r20/external/pigweed/pw_hex_dump/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_hex_dump:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker===========
4*61c4878aSAndroid Build Coastguard Workerpw_hex_dump
5*61c4878aSAndroid Build Coastguard Worker===========
6*61c4878aSAndroid Build Coastguard Worker.. pigweed-module::
7*61c4878aSAndroid Build Coastguard Worker   :name: pw_hex_dump
8*61c4878aSAndroid Build Coastguard Worker
9*61c4878aSAndroid Build Coastguard WorkerSometimes on embedded systems there's a desire to view memory contents when
10*61c4878aSAndroid Build Coastguard Workerdebugging various issues. While in some cases this can be done by attaching an
11*61c4878aSAndroid Build Coastguard Workerin-circuit debugger of some kind, form-factor hardware might not have this as an
12*61c4878aSAndroid Build Coastguard Workeroption due to size constraints. Additionally, there's often quite a bit more
13*61c4878aSAndroid Build Coastguard Workersetup involved than simply adding a print statement.
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard WorkerA common practice to address this is setting up print statements that dump data
16*61c4878aSAndroid Build Coastguard Workeras logs when a certain event occurs. There's often value to formatting these
17*61c4878aSAndroid Build Coastguard Workerdumps as human readable key-value pairs, but sometimes there's a need to see the
18*61c4878aSAndroid Build Coastguard Workerraw binary data in different ways. This can help validate in memory/on flash
19*61c4878aSAndroid Build Coastguard Workerbinary structure of stored data, among other things.
20*61c4878aSAndroid Build Coastguard Worker
21*61c4878aSAndroid Build Coastguard Worker``pw_hex_dump`` is a handy toolbox that provides utilities to help dump data as
22*61c4878aSAndroid Build Coastguard Workerhex to debug issues. Unless otherwise specified, avoid depending directly on the
23*61c4878aSAndroid Build Coastguard Workerformatting of the output as it may change (unless otherwise specified). With
24*61c4878aSAndroid Build Coastguard Workerthat said, the ``FormattedHexDumper`` strives to be xxd compatible by default.
25*61c4878aSAndroid Build Coastguard Worker
26*61c4878aSAndroid Build Coastguard Worker.. toctree::
27*61c4878aSAndroid Build Coastguard Worker   :hidden:
28*61c4878aSAndroid Build Coastguard Worker   :maxdepth: 1
29*61c4878aSAndroid Build Coastguard Worker
30*61c4878aSAndroid Build Coastguard Worker   api
31