mapfile-parser 2.9.2__tar.gz → 2.9.4__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.
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/CHANGELOG.md +17 -1
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/Cargo.lock +1 -1
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/Cargo.toml +1 -1
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/PKG-INFO +3 -3
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/README.md +2 -2
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/pyproject.toml +1 -1
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/__init__.py +1 -1
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/lib.rs +1 -1
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/parser.rs +134 -41
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/section.rs +10 -44
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/segment.rs +1 -1
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/.gitattributes +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/.gitignore +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/LICENSE +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/__main__.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/__init__.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/bss_check.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/first_diff.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/jsonify.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/objdiff_report.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/pj64_syms.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/progress.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/sym_info.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/symbol_sizes_csv.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/upload_frogress.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/internals/__init__.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/internals/objdiff_report.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/mapfile.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/mapfile_parser.pyi +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/mapfile_rs.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/progress_stats.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/progress_stats_rs.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/utils.py +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/found_symbol_info.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/mapfile.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/maps_comparison_info.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/progress_stats.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/report.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/symbol.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/symbol_comparison_info.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/symbol_decomp_state.rs +0 -0
- {mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/rs/utils.rs +0 -0
|
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.9.4] - 2025-06-02
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Implement parsing for `mwld` 2.7+ generated mapfiles.
|
|
15
|
+
- Handle `*fill*`s in `mwld`.
|
|
16
|
+
|
|
17
|
+
## [2.9.3] - 2025-06-01
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Try to infer the rom address of sections and segments even when the mapfile
|
|
22
|
+
does not have it explictly on GNU mapfiles.
|
|
23
|
+
|
|
10
24
|
## [2.9.2] - 2025-05-28
|
|
11
25
|
|
|
12
26
|
### Changed
|
|
@@ -606,7 +620,9 @@ Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73
|
|
|
606
620
|
- Initial release
|
|
607
621
|
|
|
608
622
|
[unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/master...develop
|
|
609
|
-
[2.9.
|
|
623
|
+
[2.9.4]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.3...2.9.4
|
|
624
|
+
[2.9.3]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.2...2.9.3
|
|
625
|
+
[2.9.2]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.1...2.9.2
|
|
610
626
|
[2.9.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.9.0...2.9.1
|
|
611
627
|
[2.9.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.8.1...2.9.0
|
|
612
628
|
[2.8.1]: https://github.com/Decompollaborate/mapfile_parser/compare/2.8.0...2.8.1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapfile_parser
|
|
3
|
-
Version: 2.9.
|
|
3
|
+
Version: 2.9.4
|
|
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.
|
|
58
|
+
mapfile_parser>=2.9.4,<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.
|
|
97
|
+
mapfile_parser = "2.9.4"
|
|
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.
|
|
39
|
+
mapfile_parser>=2.9.4,<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.
|
|
78
|
+
mapfile_parser = "2.9.4"
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
## Versioning and changelog
|
|
@@ -232,7 +232,7 @@ impl MapFile {
|
|
|
232
232
|
filepath,
|
|
233
233
|
vram,
|
|
234
234
|
size,
|
|
235
|
-
section_type,
|
|
235
|
+
section_type.into(),
|
|
236
236
|
));
|
|
237
237
|
} else if let Some(section_alone_match) =
|
|
238
238
|
regex_section_alone_entry.captures(prev_line)
|
|
@@ -250,7 +250,7 @@ impl MapFile {
|
|
|
250
250
|
filepath,
|
|
251
251
|
vram,
|
|
252
252
|
size,
|
|
253
|
-
section_type,
|
|
253
|
+
section_type.into(),
|
|
254
254
|
));
|
|
255
255
|
}
|
|
256
256
|
}
|
|
@@ -319,7 +319,7 @@ impl MapFile {
|
|
|
319
319
|
filepath,
|
|
320
320
|
vram,
|
|
321
321
|
size,
|
|
322
|
-
|
|
322
|
+
section_type,
|
|
323
323
|
));
|
|
324
324
|
}
|
|
325
325
|
}
|
|
@@ -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
|
|
363
|
-
vrom_offset =
|
|
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
|
|
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
|
|
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
|
|
427
|
+
vrom_offset += section.size;
|
|
428
|
+
current_calculated_section_rom += section.size;
|
|
419
429
|
}
|
|
420
430
|
|
|
421
431
|
new_segment.sections_list.push(section);
|
|
@@ -487,8 +497,8 @@ impl MapFile {
|
|
|
487
497
|
}
|
|
488
498
|
|
|
489
499
|
let mut new_section =
|
|
490
|
-
section::Section::new_fill(filepath, vram, size,
|
|
491
|
-
if !utils::is_noload_section(§ion_type) {
|
|
500
|
+
section::Section::new_fill(filepath, vram, size, section_type);
|
|
501
|
+
if !utils::is_noload_section(&new_section.section_type) {
|
|
492
502
|
new_section.vrom = vrom;
|
|
493
503
|
}
|
|
494
504
|
current_segment.sections_list.push(new_section);
|
|
@@ -500,9 +510,13 @@ impl MapFile {
|
|
|
500
510
|
if size > 0 {
|
|
501
511
|
let current_segment = temp_segment_list.last_mut().unwrap();
|
|
502
512
|
|
|
503
|
-
let mut new_section =
|
|
504
|
-
|
|
505
|
-
|
|
513
|
+
let mut new_section = section::Section::new_default(
|
|
514
|
+
filepath,
|
|
515
|
+
vram,
|
|
516
|
+
size,
|
|
517
|
+
section_type.into(),
|
|
518
|
+
);
|
|
519
|
+
if !utils::is_noload_section(&new_section.section_type) {
|
|
506
520
|
new_section.vrom = vrom;
|
|
507
521
|
}
|
|
508
522
|
new_section.align = Some(align);
|
|
@@ -598,34 +612,41 @@ impl MapFile {
|
|
|
598
612
|
let map_data = preprocess_map_data_mw(map_contents);
|
|
599
613
|
|
|
600
614
|
let memory_map = parse_memory_map_mw(map_data);
|
|
601
|
-
|
|
602
|
-
// Almost every line starts with this information, so instead of duplicating it we put them on one single regex
|
|
603
|
-
let regex_row_entry = Regex::new(r"^\s*(?P<starting>[0-9a-fA-F]+)\s+(?P<size>[0-9a-fA-F]+)\s+(?P<vram>[0-9a-fA-F]+)\s+(?P<align>[0-9a-fA-F]+)\s+(?P<subline>.+)").unwrap();
|
|
604
|
-
|
|
605
|
-
let regex_segment_entry = Regex::new(r"^(?P<name>.+) section layout$").unwrap();
|
|
606
|
-
let regex_label_entry =
|
|
607
|
-
Regex::new(r"^(?P<label>lbl_[0-9A-F]{8})\s+(?P<filename>.+?)\s*$").unwrap();
|
|
608
|
-
let regex_symbol_entry =
|
|
609
|
-
Regex::new(r"^\s*(?P<name>[^ ]+)\s+(?P<filename>.+?)\s*$").unwrap();
|
|
615
|
+
let regex_entries = MwRegexEntries::new(map_data);
|
|
610
616
|
|
|
611
617
|
let mut temp_segment_list = vec![segment::Segment::new_placeholder()];
|
|
612
618
|
|
|
613
619
|
// Use a bunch of characters that shouldn't be valid in any os as a marker that we haven't found a file yet.
|
|
614
|
-
let
|
|
620
|
+
let invalid_file_name = "invalid file <>:\"/\\|?*";
|
|
621
|
+
let mut current_filename = invalid_file_name.to_string();
|
|
615
622
|
|
|
616
623
|
for line in map_data.lines() {
|
|
617
|
-
// Check for
|
|
618
|
-
if let Some(row_entry_match) =
|
|
624
|
+
// Check for regex_entries.common_row first since it is more likely to match
|
|
625
|
+
if let (Some(row_entry_match), false) = (
|
|
626
|
+
regex_entries.common_row.captures(line),
|
|
627
|
+
temp_segment_list.is_empty(),
|
|
628
|
+
) {
|
|
619
629
|
let starting = utils::parse_hex(&row_entry_match["starting"]);
|
|
620
630
|
let size = utils::parse_hex(&row_entry_match["size"]);
|
|
621
631
|
let vram = utils::parse_hex(&row_entry_match["vram"]);
|
|
622
632
|
let align = utils::parse_hex(&row_entry_match["align"]);
|
|
623
633
|
|
|
634
|
+
let rom = row_entry_match.name("rom").map_or_else(
|
|
635
|
+
|| {
|
|
636
|
+
temp_segment_list
|
|
637
|
+
.last()
|
|
638
|
+
.unwrap()
|
|
639
|
+
.vrom
|
|
640
|
+
.map(|segment_rom| segment_rom + starting)
|
|
641
|
+
},
|
|
642
|
+
|x| Some(utils::parse_hex(x.as_str())),
|
|
643
|
+
);
|
|
644
|
+
|
|
624
645
|
let subline = &row_entry_match["subline"];
|
|
625
646
|
|
|
626
|
-
if
|
|
647
|
+
if regex_entries.label.is_match(subline) {
|
|
627
648
|
// pass
|
|
628
|
-
} else if let Some(symbol_entry_match) =
|
|
649
|
+
} else if let Some(symbol_entry_match) = regex_entries.symbol.captures(subline) {
|
|
629
650
|
let filename = &symbol_entry_match["filename"];
|
|
630
651
|
|
|
631
652
|
if filename == current_filename {
|
|
@@ -642,7 +663,7 @@ impl MapFile {
|
|
|
642
663
|
new_symbol.size = size;
|
|
643
664
|
}
|
|
644
665
|
if !current_section.is_noload_section() {
|
|
645
|
-
new_symbol.vrom =
|
|
666
|
+
new_symbol.vrom = rom
|
|
646
667
|
}
|
|
647
668
|
if align > 0 {
|
|
648
669
|
new_symbol.align = Some(align);
|
|
@@ -652,27 +673,62 @@ impl MapFile {
|
|
|
652
673
|
}
|
|
653
674
|
} else {
|
|
654
675
|
// New file!
|
|
655
|
-
current_filename = filename.to_string();
|
|
656
|
-
|
|
657
676
|
if size > 0 {
|
|
658
677
|
let section_type = &symbol_entry_match["name"];
|
|
659
678
|
let filepath = PathBuf::from(filename);
|
|
660
679
|
|
|
661
680
|
let current_segment = temp_segment_list.last_mut().unwrap();
|
|
662
681
|
|
|
663
|
-
let mut new_section =
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
682
|
+
let mut new_section = section::Section::new_default(
|
|
683
|
+
filepath,
|
|
684
|
+
vram,
|
|
685
|
+
size,
|
|
686
|
+
section_type.into(),
|
|
687
|
+
);
|
|
688
|
+
if !utils::is_noload_section(&new_section.section_type) {
|
|
689
|
+
new_section.vrom = rom
|
|
667
690
|
}
|
|
668
691
|
|
|
669
692
|
current_segment.sections_list.push(new_section);
|
|
693
|
+
|
|
694
|
+
// I'm not sure how to treat these cases.
|
|
695
|
+
// I guess we can treat them as files without symbols for now...
|
|
696
|
+
current_filename = if filename == "Linker Generated Symbol File" {
|
|
697
|
+
invalid_file_name.to_string()
|
|
698
|
+
} else {
|
|
699
|
+
filename.to_string()
|
|
700
|
+
};
|
|
670
701
|
}
|
|
671
702
|
}
|
|
703
|
+
} else if regex_entries.fill.is_match(subline) {
|
|
704
|
+
// Make a dummy section to handle pads
|
|
705
|
+
let current_segment = temp_segment_list.last_mut().unwrap();
|
|
706
|
+
|
|
707
|
+
let mut filepath = PathBuf::new();
|
|
708
|
+
let mut section_type = "".to_owned();
|
|
709
|
+
|
|
710
|
+
if let Some(prev_section) = current_segment.sections_list.last() {
|
|
711
|
+
let mut name = prev_section.filepath.file_name().unwrap().to_owned();
|
|
712
|
+
|
|
713
|
+
name.push("__fill__");
|
|
714
|
+
filepath = prev_section.filepath.with_file_name(name);
|
|
715
|
+
section_type.clone_from(&prev_section.section_type);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
let mut new_section =
|
|
719
|
+
section::Section::new_fill(filepath, vram, size, section_type);
|
|
720
|
+
new_section.align = Some(align);
|
|
721
|
+
if !utils::is_noload_section(&new_section.section_type) {
|
|
722
|
+
new_section.vrom = rom;
|
|
723
|
+
}
|
|
724
|
+
current_segment.sections_list.push(new_section);
|
|
725
|
+
|
|
726
|
+
// Don't count this as a valid file.
|
|
727
|
+
current_filename = invalid_file_name.to_string();
|
|
672
728
|
} else {
|
|
673
|
-
println!("{}", subline);
|
|
729
|
+
// println!("'{}'", subline);
|
|
674
730
|
}
|
|
675
|
-
} else if let Some(segment_entry_match) =
|
|
731
|
+
} else if let Some(segment_entry_match) = regex_entries.segment.captures(line) {
|
|
676
732
|
let name = &segment_entry_match["name"];
|
|
677
733
|
|
|
678
734
|
let new_segment = if let Some(segment_entry) = memory_map.get(name) {
|
|
@@ -687,6 +743,10 @@ impl MapFile {
|
|
|
687
743
|
};
|
|
688
744
|
|
|
689
745
|
temp_segment_list.push(new_segment);
|
|
746
|
+
|
|
747
|
+
// Reset the tracked filename state.
|
|
748
|
+
// This avoid carrying the filename from one segment to the other
|
|
749
|
+
current_filename = invalid_file_name.to_string();
|
|
690
750
|
}
|
|
691
751
|
}
|
|
692
752
|
|
|
@@ -694,7 +754,6 @@ impl MapFile {
|
|
|
694
754
|
}
|
|
695
755
|
|
|
696
756
|
fn post_process_segments_mw(temp_segment_list: Vec<segment::Segment>) -> Vec<segment::Segment> {
|
|
697
|
-
// TODO: actually implement
|
|
698
757
|
let mut segments_list = Vec::with_capacity(temp_segment_list.len());
|
|
699
758
|
|
|
700
759
|
for (i, segment) in temp_segment_list.into_iter().enumerate() {
|
|
@@ -783,6 +842,40 @@ fn parse_memory_map_mw(map_data: &str) -> HashMap<String, MwMemoryMapEntry> {
|
|
|
783
842
|
memory_map
|
|
784
843
|
}
|
|
785
844
|
|
|
845
|
+
struct MwRegexEntries {
|
|
846
|
+
common_row: Regex,
|
|
847
|
+
segment: Regex,
|
|
848
|
+
label: Regex,
|
|
849
|
+
symbol: Regex,
|
|
850
|
+
fill: Regex,
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
impl MwRegexEntries {
|
|
854
|
+
fn new(map_data: &str) -> Self {
|
|
855
|
+
// Almost every line starts with this information, so instead of duplicating it we put them on one single regex
|
|
856
|
+
let common_row = if map_data.contains("address Size address offset") {
|
|
857
|
+
// mwld 2.7+
|
|
858
|
+
Regex::new(r"^\s*(?P<starting>[0-9a-fA-F]+)\s+(?P<size>[0-9a-fA-F]+)\s+(?P<vram>[0-9a-fA-F]+)\s+(?P<rom>[0-9a-fA-F]+)\s+(?P<align>[0-9a-fA-F]+)\s+(?P<subline>.+)").unwrap()
|
|
859
|
+
} else {
|
|
860
|
+
// mwld 1.3.2-
|
|
861
|
+
Regex::new(r"^\s*(?P<starting>[0-9a-fA-F]+)\s+(?P<size>[0-9a-fA-F]+)\s+(?P<vram>[0-9a-fA-F]+)\s+(?P<align>[0-9a-fA-F]+)\s+(?P<subline>.+)").unwrap()
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
let segment = Regex::new(r"^(?P<name>.+) section layout$").unwrap();
|
|
865
|
+
let label = Regex::new(r"^(?P<label>lbl_[0-9A-F]{8})\s+(?P<filename>.+?)\s*$").unwrap();
|
|
866
|
+
let symbol = Regex::new(r"^\s*(?P<name>[^ ]+)\s+(?P<filename>.+?)\s*$").unwrap();
|
|
867
|
+
let fill = Regex::new(r"^\s*\*fill\*\s*$").unwrap();
|
|
868
|
+
|
|
869
|
+
Self {
|
|
870
|
+
common_row,
|
|
871
|
+
segment,
|
|
872
|
+
label,
|
|
873
|
+
symbol,
|
|
874
|
+
fill,
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
786
879
|
impl MapFile {
|
|
787
880
|
fn preprocess_map_data_gnu(map_data: &str) -> &str {
|
|
788
881
|
// Skip the stuff we don't care about
|
|
@@ -42,7 +42,7 @@ impl Section {
|
|
|
42
42
|
filepath: PathBuf,
|
|
43
43
|
vram: u64,
|
|
44
44
|
size: u64,
|
|
45
|
-
section_type:
|
|
45
|
+
section_type: String,
|
|
46
46
|
vrom: Option<u64>,
|
|
47
47
|
align: Option<u64>,
|
|
48
48
|
) -> Self {
|
|
@@ -53,7 +53,7 @@ impl Section {
|
|
|
53
53
|
filepath: PathBuf,
|
|
54
54
|
vram: u64,
|
|
55
55
|
size: u64,
|
|
56
|
-
section_type:
|
|
56
|
+
section_type: String,
|
|
57
57
|
vrom: Option<u64>,
|
|
58
58
|
align: Option<u64>,
|
|
59
59
|
is_fill: bool,
|
|
@@ -62,7 +62,7 @@ impl Section {
|
|
|
62
62
|
filepath,
|
|
63
63
|
vram,
|
|
64
64
|
size,
|
|
65
|
-
section_type
|
|
65
|
+
section_type,
|
|
66
66
|
vrom,
|
|
67
67
|
align,
|
|
68
68
|
is_fill,
|
|
@@ -303,52 +303,20 @@ impl Section {
|
|
|
303
303
|
|
|
304
304
|
impl Section {
|
|
305
305
|
pub(crate) fn new_default(
|
|
306
|
-
filepath:
|
|
306
|
+
filepath: PathBuf,
|
|
307
307
|
vram: u64,
|
|
308
308
|
size: u64,
|
|
309
|
-
section_type:
|
|
309
|
+
section_type: String,
|
|
310
310
|
) -> Self {
|
|
311
|
-
|
|
312
|
-
filepath,
|
|
313
|
-
vram,
|
|
314
|
-
size,
|
|
315
|
-
section_type: section_type.into(),
|
|
316
|
-
vrom: None,
|
|
317
|
-
align: None,
|
|
318
|
-
is_fill: false,
|
|
319
|
-
symbols: Vec::new(),
|
|
320
|
-
}
|
|
311
|
+
Self::new_impl(filepath, vram, size, section_type, None, None, false)
|
|
321
312
|
}
|
|
322
313
|
|
|
323
314
|
pub(crate) fn new_placeholder() -> Self {
|
|
324
|
-
Self
|
|
325
|
-
filepath: "".into(),
|
|
326
|
-
vram: 0,
|
|
327
|
-
size: 0,
|
|
328
|
-
section_type: "".into(),
|
|
329
|
-
vrom: None,
|
|
330
|
-
align: None,
|
|
331
|
-
is_fill: false,
|
|
332
|
-
symbols: Vec::new(),
|
|
333
|
-
}
|
|
315
|
+
Self::new_impl("".into(), 0, 0, "".into(), None, None, false)
|
|
334
316
|
}
|
|
335
317
|
|
|
336
|
-
pub(crate) fn new_fill(
|
|
337
|
-
filepath
|
|
338
|
-
vram: u64,
|
|
339
|
-
size: u64,
|
|
340
|
-
section_type: &str,
|
|
341
|
-
) -> Self {
|
|
342
|
-
Self {
|
|
343
|
-
filepath,
|
|
344
|
-
vram,
|
|
345
|
-
size,
|
|
346
|
-
section_type: section_type.into(),
|
|
347
|
-
vrom: None,
|
|
348
|
-
align: None,
|
|
349
|
-
is_fill: true,
|
|
350
|
-
symbols: Vec::new(),
|
|
351
|
-
}
|
|
318
|
+
pub(crate) fn new_fill(filepath: PathBuf, vram: u64, size: u64, section_type: String) -> Self {
|
|
319
|
+
Self::new_impl(filepath, vram, size, section_type, None, None, true)
|
|
352
320
|
}
|
|
353
321
|
|
|
354
322
|
pub fn is_placeholder(&self) -> bool {
|
|
@@ -420,8 +388,6 @@ impl Hash for Section {
|
|
|
420
388
|
pub(crate) mod python_bindings {
|
|
421
389
|
use pyo3::{intern, prelude::*, IntoPyObjectExt};
|
|
422
390
|
|
|
423
|
-
use std::path::PathBuf;
|
|
424
|
-
|
|
425
391
|
// Required to call the `.hash` and `.finish` methods, which are defined on traits.
|
|
426
392
|
use std::hash::{Hash, Hasher};
|
|
427
393
|
|
|
@@ -439,7 +405,7 @@ pub(crate) mod python_bindings {
|
|
|
439
405
|
filepath: PathBuf,
|
|
440
406
|
vram: u64,
|
|
441
407
|
size: u64,
|
|
442
|
-
section_type:
|
|
408
|
+
section_type: String,
|
|
443
409
|
vrom: Option<u64>,
|
|
444
410
|
align: Option<u64>,
|
|
445
411
|
is_fill: bool,
|
|
@@ -195,7 +195,7 @@ impl Segment {
|
|
|
195
195
|
let vram = first_section.vram;
|
|
196
196
|
let mut size = 0;
|
|
197
197
|
let vrom = first_section.vrom;
|
|
198
|
-
let section_type =
|
|
198
|
+
let section_type = first_section.section_type.clone();
|
|
199
199
|
let align = first_section.align;
|
|
200
200
|
|
|
201
201
|
let mut symbols = Vec::new();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/objdiff_report.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/symbol_sizes_csv.py
RENAMED
|
File without changes
|
{mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/frontends/upload_frogress.py
RENAMED
|
File without changes
|
|
File without changes
|
{mapfile_parser-2.9.2 → mapfile_parser-2.9.4}/src/mapfile_parser/internals/objdiff_report.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|