mapfile-parser 2.9.1__tar.gz → 2.9.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/CHANGELOG.md +20 -0
  2. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/Cargo.lock +1 -1
  3. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/Cargo.toml +1 -1
  4. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/PKG-INFO +3 -3
  5. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/README.md +2 -2
  6. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/pyproject.toml +1 -1
  7. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/__init__.py +1 -1
  8. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/objdiff_report.py +30 -8
  9. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/parser.rs +19 -9
  10. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/.gitattributes +0 -0
  11. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/.gitignore +0 -0
  12. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/LICENSE +0 -0
  13. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/__main__.py +0 -0
  14. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/__init__.py +0 -0
  15. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/bss_check.py +0 -0
  16. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/first_diff.py +0 -0
  17. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/jsonify.py +0 -0
  18. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/pj64_syms.py +0 -0
  19. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/progress.py +0 -0
  20. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/sym_info.py +0 -0
  21. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/symbol_sizes_csv.py +0 -0
  22. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/frontends/upload_frogress.py +0 -0
  23. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/internals/__init__.py +0 -0
  24. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/internals/objdiff_report.py +0 -0
  25. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/mapfile.py +0 -0
  26. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/mapfile_parser.pyi +0 -0
  27. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/mapfile_rs.py +0 -0
  28. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/progress_stats.py +0 -0
  29. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/progress_stats_rs.py +0 -0
  30. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/mapfile_parser/utils.py +0 -0
  31. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/found_symbol_info.rs +0 -0
  32. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/lib.rs +0 -0
  33. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/mapfile.rs +0 -0
  34. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/maps_comparison_info.rs +0 -0
  35. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/progress_stats.rs +0 -0
  36. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/report.rs +0 -0
  37. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/section.rs +0 -0
  38. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/segment.rs +0 -0
  39. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/symbol.rs +0 -0
  40. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/symbol_comparison_info.rs +0 -0
  41. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/symbol_decomp_state.rs +0 -0
  42. {mapfile_parser-2.9.1 → mapfile_parser-2.9.3}/src/rs/utils.rs +0 -0
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.9.3] - 2025-06-01
11
+
12
+ ### Fixed
13
+
14
+ - Try to infer the rom address of sections and segments even when the mapfile
15
+ does not have it explictly on GNU mapfiles.
16
+
17
+ ## [2.9.2] - 2025-05-28
18
+
19
+ ### Changed
20
+
21
+ - `objdiff_report`:
22
+ - Simplify emitted entries by avoiding using quotes as much as possible when
23
+ using the `--emit-categories` flag.
24
+ - Avoid printing the summary table when using the `--emit-categories`.
25
+ - Allow customizing the output of the summary table a little bit via the
26
+ Python API.
27
+
10
28
  ## [2.9.1] - 2025-05-27
11
29
 
12
30
  ### Added
@@ -595,6 +613,8 @@ Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73
595
613
  - Initial release
596
614
 
597
615
  [unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/master...develop
616
+ [2.9.3]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.2...2.9.3
617
+ [2.9.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.1...2.9.2
598
618
  [2.9.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.0...2.9.1
599
619
  [2.9.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.8.1...2.9.0
600
620
  [2.8.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.8.0...2.8.1
@@ -171,7 +171,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
171
171
 
172
172
  [[package]]
173
173
  name = "mapfile_parser"
174
- version = "2.9.1"
174
+ version = "2.9.3"
175
175
  dependencies = [
176
176
  "lazy_static",
177
177
  "objdiff-core",
@@ -3,7 +3,7 @@
3
3
 
4
4
  [package]
5
5
  name = "mapfile_parser"
6
- version = "2.9.1"
6
+ version = "2.9.3"
7
7
  edition = "2021"
8
8
  rust-version = "1.74.0"
9
9
  authors = ["Anghelo Carvajal <angheloalf95@gmail.com>"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapfile_parser
3
- Version: 2.9.1
3
+ Version: 2.9.3
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -55,7 +55,7 @@ If you use a `requirements.txt` file in your repository, then you can add
55
55
  this library with the following line:
56
56
 
57
57
  ```txt
58
- mapfile_parser>=2.9.1,<3.0.0
58
+ mapfile_parser>=2.9.3,<3.0.0
59
59
  ```
60
60
 
61
61
  #### Development version
@@ -94,7 +94,7 @@ cargo add mapfile_parser
94
94
  Or add the following line manually to your `Cargo.toml` file:
95
95
 
96
96
  ```toml
97
- mapfile_parser = "2.9.1"
97
+ mapfile_parser = "2.9.3"
98
98
  ```
99
99
 
100
100
  ## Versioning and changelog
@@ -36,7 +36,7 @@ If you use a `requirements.txt` file in your repository, then you can add
36
36
  this library with the following line:
37
37
 
38
38
  ```txt
39
- mapfile_parser>=2.9.1,<3.0.0
39
+ mapfile_parser>=2.9.3,<3.0.0
40
40
  ```
41
41
 
42
42
  #### Development version
@@ -75,7 +75,7 @@ cargo add mapfile_parser
75
75
  Or add the following line manually to your `Cargo.toml` file:
76
76
 
77
77
  ```toml
78
- mapfile_parser = "2.9.1"
78
+ mapfile_parser = "2.9.3"
79
79
  ```
80
80
 
81
81
  ## Versioning and changelog
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = "mapfile_parser"
6
- version = "2.9.1"
6
+ version = "2.9.3"
7
7
  description = "Map file parser library focusing decompilation projects"
8
8
  readme = "README.md"
9
9
  requires-python = ">=3.9"
@@ -5,7 +5,7 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- __version_info__ = (2, 9, 1)
8
+ __version_info__ = (2, 9, 3)
9
9
  __version__ = ".".join(map(str, __version_info__)) # + "-dev0"
10
10
  __author__ = "Decompollaborate"
11
11
 
@@ -16,6 +16,12 @@ from .. import utils
16
16
  from ..internals import objdiff_report as report_internal
17
17
 
18
18
 
19
+ @dataclasses.dataclass
20
+ class SummaryTableConfig:
21
+ doUnits: bool = False
22
+ sort: bool = True
23
+ remaining: bool = False
24
+
19
25
  def doObjdiffReport(
20
26
  mapPath: Path,
21
27
  outputPath: Path,
@@ -27,6 +33,7 @@ def doObjdiffReport(
27
33
  nonmatchingsPath: Path|None=None,
28
34
  emitCategories: bool=False,
29
35
  quiet: bool=False,
36
+ summaryTableConfig: SummaryTableConfig|None=SummaryTableConfig(),
30
37
  ) -> int:
31
38
  if not mapPath.exists():
32
39
  print(f"Could not find mapfile at '{mapPath}'")
@@ -47,12 +54,16 @@ def doObjdiffReport(
47
54
  nonmatchingsPath=nonmatchingsPath,
48
55
  )
49
56
 
50
- if not quiet:
57
+ if not quiet and summaryTableConfig is not None and not emitCategories:
51
58
  report = report_internal.Report.readFile(outputPath)
52
59
  if report is None:
53
60
  utils.eprint(f"Unable to read back the generated report at {outputPath}")
54
61
  return 1
55
- table = report.asTableStr(sort=True)
62
+ table = report.asTableStr(
63
+ do_units=summaryTableConfig.doUnits,
64
+ sort=summaryTableConfig.sort,
65
+ remaining=summaryTableConfig.remaining,
66
+ )
56
67
  print(table, end="")
57
68
 
58
69
  # Output to GitHub Actions job summary, if available
@@ -241,18 +252,26 @@ tools:
241
252
  prefixes_to_trim:
242
253
  """, end="")
243
254
  for trim in prefixesToTrim:
244
- print(f" - \"{trim}\"")
255
+ print(f" - {trim}")
245
256
 
246
257
  def printCategories(categories: list[Category]):
247
258
  for cat in categories:
259
+ ide = cat.ide
260
+ name = cat.name
261
+ if ide[0] in "0123456789":
262
+ ide = f'"{ide}"'
263
+ if name[0] in "0123456789":
264
+ name = f'"{name}"'
248
265
  print(f"""\
249
- - id: "{cat.ide}"
250
- name: "{cat.name}"
266
+ - id: {ide}
267
+ name: {name}
251
268
  paths:
252
269
  """, end="")
253
270
  for p in cat.paths:
271
+ if p[0] in "0123456789":
272
+ p = f'"{p}"'
254
273
  print(f"""\
255
- - "{p}"
274
+ - {p}
256
275
  """, end="")
257
276
 
258
277
  print(" categories:")
@@ -323,7 +342,10 @@ def processArguments(args: argparse.Namespace, decompConfig: decomp_settings.Con
323
342
  nonmatchingsPath = args.nonmatchingspath
324
343
 
325
344
  emitCategories: bool = args.emit_categories
326
- quiet: bool= args.quiet
345
+ if not args.quiet:
346
+ summaryTableConfig = SummaryTableConfig()
347
+ else:
348
+ summaryTableConfig = None
327
349
 
328
350
  exit(doObjdiffReport(
329
351
  mapPath,
@@ -334,7 +356,7 @@ def processArguments(args: argparse.Namespace, decompConfig: decomp_settings.Con
334
356
  pathIndex=pathIndex,
335
357
  nonmatchingsPath=nonmatchingsPath,
336
358
  emitCategories=emitCategories,
337
- quiet=quiet
359
+ summaryTableConfig=summaryTableConfig,
338
360
  ))
339
361
 
340
362
  def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig: decomp_settings.Config|None=None):
@@ -335,6 +335,9 @@ impl MapFile {
335
335
  ) -> Vec<segment::Segment> {
336
336
  let mut segments_list = Vec::with_capacity(temp_segment_list.len());
337
337
 
338
+ // We need to keep a calculated rom in case the segment doesn't specify it explicitly
339
+ let mut current_calculated_section_rom = 0;
340
+
338
341
  for (i, segment) in temp_segment_list.into_iter().enumerate() {
339
342
  if i == 0 && segment.is_placeholder() {
340
343
  // skip the dummy segment if it has no size, sections or symbols
@@ -347,7 +350,13 @@ impl MapFile {
347
350
 
348
351
  let mut new_segment = segment.clone_no_sectionlist();
349
352
 
350
- let mut vrom_offset = segment.vrom;
353
+ let mut vrom_offset = if let Some(vrom) = segment.vrom {
354
+ current_calculated_section_rom = vrom;
355
+ vrom
356
+ } else {
357
+ new_segment.vrom = Some(current_calculated_section_rom);
358
+ current_calculated_section_rom
359
+ };
351
360
  for mut section in segment.sections_list.into_iter() {
352
361
  if section.is_placeholder() {
353
362
  // drop placeholders
@@ -359,12 +368,12 @@ impl MapFile {
359
368
  let symbols_count = section.symbols.len();
360
369
  let is_noload_section = section.is_noload_section();
361
370
 
362
- if section.vrom.is_some() {
363
- vrom_offset = section.vrom;
371
+ if let Some(vrom) = section.vrom {
372
+ vrom_offset = vrom;
364
373
  }
365
374
 
366
375
  if !is_noload_section {
367
- section.vrom = vrom_offset;
376
+ section.vrom = Some(vrom_offset);
368
377
  }
369
378
 
370
379
  if symbols_count > 0 {
@@ -377,7 +386,7 @@ impl MapFile {
377
386
  // by the difference in vram address between the first symbol and the vram
378
387
  // of the section.
379
388
  if let Some(first_sym) = section.symbols.first() {
380
- sym_vrom = sym_vrom.map(|x| x + first_sym.vram - section.vram);
389
+ sym_vrom = sym_vrom + first_sym.vram - section.vram;
381
390
 
382
391
  // Aditionally, if the first symbol is missing then calculation of the size
383
392
  // for the last symbol would be wrong, since we subtract the accumulated
@@ -397,8 +406,8 @@ impl MapFile {
397
406
 
398
407
  if !is_noload_section {
399
408
  // Only set vrom of non bss variables
400
- sym.vrom = sym_vrom;
401
- sym_vrom = sym_vrom.map(|x| x + sym_size);
409
+ sym.vrom = Some(sym_vrom);
410
+ sym_vrom += sym_size;
402
411
  }
403
412
  }
404
413
 
@@ -407,7 +416,7 @@ impl MapFile {
407
416
  let sym_size = section.size - acummulated_size;
408
417
  sym.size = sym_size;
409
418
  if !is_noload_section {
410
- sym.vrom = sym_vrom;
419
+ sym.vrom = Some(sym_vrom);
411
420
  //sym_vrom += sym_size;
412
421
  }
413
422
 
@@ -415,7 +424,8 @@ impl MapFile {
415
424
  }
416
425
 
417
426
  if !is_noload_section {
418
- vrom_offset = vrom_offset.map(|x| x + section.size);
427
+ vrom_offset += section.size;
428
+ current_calculated_section_rom += section.size;
419
429
  }
420
430
 
421
431
  new_segment.sections_list.push(section);
File without changes