mapfile_parser 2.7.2

Map file parser library focusing decompilation projects
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.7.2] - 2024-12-15

### Added

- Prebuilt binaries for Python 3.13.

### Changed

- Python 3.9 or later is now required.
  - Bump from Python 3.8 to 3.9.
  - Older versions can't be checked on CI anymore, so I prefer to not claim to
    support something that may have broken without anybody noticing.
  - Nothing really changed. Just the CI tools I was using are refusing to use
    any Python version older than this. Sorry if you were affected by this.
- Use newer pyo3 version.
  - From 0.20 to 0.23.
  - Updated to avoid warnings with newer Rust versions.
  - Fix issues introduced by updating pyo3.

## [2.7.1] - 2024-09-25

### Added

- Add `--json` flag to `progress` frontend.
  - Prints the output as json instead of using a human readable format.

### Changed

- Improve lifetime usage and avoid unnecessary clones on Rust side.

## [2.7.0] - 2024-09-24

### Added

- `MapFile.findSymbolByVram` and `MapFile.findSymbolByVrom` methods.
  - Allow to search a symbol given a given address. The address will be treated
    as either a vram address or a vrom address respectively.
- Add `--vram`, `--vrom` and `--name` arguments to `sym_info` frontend.
  - Allow to tell to `sym_info` exactly how to treat the argument instead of
    trying to guess how to use it.
- `sym_info` can now detect that an address may belong to a file even when the
  symbol itself may not exist on the mapfile.
  - This can happen for local symbols, for example for rodata literals.

### Deprecated

- `MapFile.findSymbolByVramOrVrom`.
  - Use `MapFile.findSymbolByVram` and `MapFile.findSymbolByVrom` instead.

### Fixed

- Fix typo that prevented using `jsonify`.

## [2.6.0] - 2024-08-26

### Added

- Add new parameters to `bss_check.printSymbolComparison`.
  - `printGoods`: Allows toggling printing the GOOD symbols.
  - `printingStyle`: The style to use to print the symbols, either `"csv"` or
    `"listing"`.
  - TODO: port to Rust.
- New `MapFile.fixupNonMatchingSymbols` method.
  - Allows to fixup size calculation of symbols messed up by symbols with the
    same name suffixed with `.NON_MATCHING`.
- Add support for `.NON_MATCHING` suffix on symbols on progress calculation.
  - If a symbol exists and has a `.NON_MATCHING`-suffixed counterpart then
    consider it not mateched yet.

### Changed

- Minor cleanups.

## [2.5.1] - 2024-08-09

### Fixed

- Fix Github Action file.

## [2.5.0] - 2024-08-09

### Added

- Add Minimal Supported Rust Version (MSRV) to Cargo.toml.
- Add `MapFile::new_from_map_file` function to simplify `MapFile` creation.
- Add `serde` feature to the Rust crate.
  - Allows serializing and deserializing a `MapFile` object using serde.

### Changed

- Tweak symbol comparison logic a bit.
  - Symbol shifting (due to different sizes or extra/missing symbols) should
    not affect comparing non shifted files.
- `Cargo.lock` file is now committed to the repo.
- Change Rust functions to properly take references instead of consuming the
  argument.

### Fixed

- Fix `MapFile::find_lowest_differing_symbol` not returning a previous symbol
  from a previous file if the symbol found is the first symbol from the file.

## [2.4.0] - 2024-03-25

### Added

- Add `endian` argument to `doFirstDiff`.
- Add `--endian` option to `first_diff` script.

### Removed

- Dropped Python 3.7 support.
  - Python 3.8 is the minimum supported version now.

## [2.3.7] - 2024-02-27

### Fixed

- Fix not recognizing file entries which are splited in two lines because its
  section name was too long to fit.

## [2.3.6] - 2024-02-23

### Added

- Add issue templates for bug reports and feature suggestions.

### Fixed

- Fix not recognizing sections that don't start with dots (`.`).

## [2.3.5] - 2024-02-04

### Fixed

- Fix `MapFile.compareFilesAndSymbols` reporting the wrong address as the
  expected address.

## [2.3.4] - 2024-01-26

### Changed

- Frontend scripts now give a better error if the mapfile does not exist.

## [2.3.2] - 2024-01-17

### Added

- Add optional `categoryColumnSize` parameter to `ProgressStats.getHeaderAsStr`
  and `ProgressStats.getEntryAsStr`.
  - Allows to set the size of the first column.

### Fixed

- Fix Rust's implementation of `File` not returning a `pathlib.Path` object for
  the `filepath` member.

## [2.3.1] - 2023-12-23

### Added

- Add a few utility methods to `ProgressStats`.

### Changed

- `pyo3` is no longer needed to use this crate as Rust-only library.
- Updated Rust dependencies.

## [2.3.0] - 2023-11-05

### Added

- Support for parsing clang lld's map fles.
- New functions:
  - `MapFile.parseMapContents`/`MapFile::parse_map_contents`
    - Parses the map contents passed as the argument, without requiring the map
      being on an actual file.
    - The map format will be guessed on the contents. Currently both the GNU ld
      and clang ld.lld map formats are recognized.
  - `MapFile.parseMapContentsGNU`/`MapFile::parse_map_contents_gnu`
    - Parses the map contents passed as the argument, without requiring the map
      being on an actual file.
    - This function only parses the GNU ld map format.
  - `MapFile.parseMapContentsLLD`/`MapFile::parse_map_contents_lld`
    - Parses the map contents passed as the argument, without requiring the map
      being on an actual file.
    - This function only parses the clang ld.lld map format.
- New members:
  - `Symbol.align`/`Symbol::align`, `File.align`/`File::align` and
    `Segment.align`/`Segment::align`: The alignment the given type. This member
    will be filled by the parser only if the mapfile provides this information.

### Changed

- `MapFile.readMapFile`/`MapFile::read_map_file` can now guess the map format
  between any of the known formats.
- Some known symbol names will be automatically filtered out during the parsing
  step.
  - Currently only `gcc2_compiled.` is filtered out.

### Fixed

- Fix parser not detecting `*fill*` lines on GNU ld maps if they specified the
  value that was used for filling/padding.
- `.sbss`, `COMMON` and `.scommon` sections are now properly considered noload
  sections.

## [2.2.1] - 2023-10-08

### Fixed

- Fix Rust crate size being too big
  - crates.io was rejecting the package because of the size
  - Cargo was packaging all the map files and test cases, making the package be
    15 MiB. Now it is around 16.3 KiB

## [2.2.0] - 2023-10-08

### Added

- Add new Rust re-implementation (#15)
  - Allows using this library in native Rust projects
  - It does not replace the Python implementation due to restrictions on how
    Rust bindings work.
  - Python bindings for the Rust implementation exists, but they are not used
    or exposed to the user
- Now this library has a Rust crate.
  - Check it at <https://crates.io/crates/mapfile_parser>

### Changed

- Speed-up the actual parsing of a mapfile by using the native Rust implementation
  - Up to 10 times faster parsing has been registered
- Change build system from `hatchling` to `maturin`

## [2.1.5] - 2023-10-02

### Added

- Add `CHANGELOG.md`
- Add markdown linter to CI

### Changed

- Cleanup the `README.md` a bit
- Update Github Action's dependencies

### Deprecated

- Deprecate `File.getName`
  - The method itself doesn't make sense, instead operate on `File.filepath` directly
- Deprecate `MapFile.debugging`
- Deprecate `progress` frontend's `--debugging` flag

## [2.1.4] - 2023-09-11

### Fixed

- Fix vrom calculation if the first symbol of a file is not available in the
  map file

## [1.3.2] - 2023-09-11

### Added

- Add version info to the cli
- Add small testing suite
- Add machine-friendly/non-human-readable option for json generation.
  - Numbers are outputted as real numbers instead of prettified strings

### Changed

- Allow csv conversion to be written to a file instead of only printing to stdout
- Output `none` instead of `"None"` for symbols with no vrom when generating
  json output.

### Fixed

- Fix vrom calculation if the first symbol of a file is not available in the
  map file

Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73452059ce4e97cda011e09dc4ef2a7b9dec...ba444b0bbfdfad7fb07347bf656b7fd4381596fb>

## [2.1.3] - 2023-08-30

### Fixed

- Fix version number
  - pypi thought previous version was a prerelease instead of a full release

## [2.1.2] - 2023-08-30

### Added

- Add machine-friendly/non-human-readable option for json generation.
  - Numbers are outputted as real numbers instead of prettified strings
- Add some CI tests

### Changed

- Output `none` instead of `"None"` for symbols with no vrom when generating
  json output.
- Make dummy files for `*fill*` lines instead of adding them to the previous file.
- Don't drop the dummy segment if it actually has data on it

## [2.1.1] - 2023-08-15

### Fixed

- Fix off-by-one issue which was throwing away tons of data

## [2.1.0] - 2023-08-14

### Added

- Add `bss_check` frontend
  - Allows to search for reordered bss variables by comparing two map files.

### Changed

- Don't skip important lines in some kinds of map files.
  - This may produce map parsing to be a bit slower but it should work properly
    with more kinds of mapfiles

### Fixed

- Try to prevent crashes if a file is found before the first segment is found

## [2.0.1] - 2023-08-07

### Changed

- Makes `Symbol`, `File` and `Segment` hashable

## [1.3.1] - 2023-08-06

### Changed

- Make `Symbol` and `File` types hashable

## [2.0.0] - 2023-08-01

### Added

- `toJson` method which allow serializing map files into the json format.
- `jsonify` frontend which allows converting a mapfile into a json format from
  the CLI.

### Changed

- Change logic of `MapFile` so it can parse and organize each file in proper
  segments.
  - This breaks old ways of iterating the `MapFile` class. Now iterating it
    yields a `Segment`, iterating that yields a `File`.
- Rename `segmentType` to `sectionType` and `filterBySegmentType` to
  `filterBySectionType`.

## [1.3.0] - 2023-08-01

### Added

- Add function `toJson` to export map file as a json. It returns a `dict`.
- New `jsonify` frontend, which allows converting a map file in the cli.

## [1.2.1] - 2023-07-28

### Fixed

- Fix missing `:` colon even when passing `addColons=True` to the `first_diff`
  frontend

## [1.2.0] - 2023-07-28

### Added

- `first_diff` frontend:
  - Allow an optional bytes converter callback. It can be useful to perform
    analysis or instruction decoding on the caller side.
  - Parameter to toggle colons (`:`) in bytes difference output

## [1.1.5] - 2023-07-28

### Fixed

- Fix map parsing ignoring some `*fill*` entries
- Improve symbol info output a bit

## [1.1.4] - 2023-04-03

### Fixed

- Add missing `request` requirement

## [1.1.3] - 2023-02-22

### Added

- Add flag to enable debug prints
- Add flag to specify the path index

### Fixed

- Properly handle files with multiple extensions

## [1.1.2] - 2022-12-14

### Changed

- Modularize `upload_frogress` frontend

## [1.1.1] - 2022-12-14

### Added

- Add examples to README

## [1.1.0] - 2022-12-14

### Added

- Compute vrom addresses of symbols and files
- Provide various front-ends clis (see README for more info):
  - `first_diff`
  - `pj64_syms`
  - `progress`
  - `sym_info`
  - `symbol_sizes_csv`
  - `upload_frogress`

[Full changelog](https://github.com/Decompollaborate/mapfile_parser/compare/1.0.0...1.1.0)

## [1.0.0] - 2022-12-13

### Added

- Initial release

[unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/master...develop
[2.7.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.7.1...2.7.2
[2.7.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.7.0...2.7.1
[2.7.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.6.0...2.7.0
[2.6.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.5.1...2.6.0
[2.5.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.5.0...2.5.1
[2.5.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.4.0...2.5.0
[2.4.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.7...2.4.0
[2.3.7]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.6...2.3.7
[2.3.6]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.5...2.3.6
[2.3.5]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.4...2.3.5
[2.3.4]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.2...2.3.4
[2.3.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.1...2.3.2
[2.3.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.3.0...2.3.1
[2.3.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.2.1...2.3.0
[2.2.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.1.5...2.2.0
[2.1.5]: https://github.com/Decompollaborate/mapfile_parser/compare/2.1.4...2.1.5
[2.1.4]: https://github.com/Decompollaborate/mapfile_parser/compare/2.1.3...2.1.4
[1.3.2]: https://github.com/Decompollaborate/mapfile_parser/compare/1.3.1...1.3.2
[2.1.3]: https://github.com/Decompollaborate/mapfile_parser/compare/2.1.2...2.1.3
[2.1.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.1.1...2.1.2
[2.1.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.0.1...2.1.0
[2.0.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.0.0...2.0.1
[1.3.1]: https://github.com/Decompollaborate/mapfile_parser/compare/1.3.0...1.3.1
[2.0.0]: https://github.com/Decompollaborate/mapfile_parser/compare/1.3.0...2.0.0
[1.3.0]: https://github.com/Decompollaborate/mapfile_parser/compare/1.2.1...1.3.0
[1.2.1]: https://github.com/Decompollaborate/mapfile_parser/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/Decompollaborate/mapfile_parser/compare/1.1.5...1.2.0
[1.1.5]: https://github.com/Decompollaborate/mapfile_parser/compare/1.1.4...1.1.5
[1.1.4]: https://github.com/Decompollaborate/mapfile_parser/compare/1.1.3...1.1.4
[1.1.3]: https://github.com/Decompollaborate/mapfile_parser/compare/1.1.2...1.1.3
[1.1.2]: https://github.com/Decompollaborate/mapfile_parser/compare/1.1.1...1.1.2
[1.1.1]: https://github.com/Decompollaborate/mapfile_parser/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/Decompollaborate/mapfile_parser/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/Decompollaborate/mapfile_parser/releases/tag/1.0.0