Changeset 813dfd86 for driver/as.cc
- Timestamp:
- Dec 6, 2021, 5:06:04 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 295dd61
- Parents:
- c60e5094
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
driver/as.cc
rc60e5094 r813dfd86 11 11 // Created On : Wed Aug 1 10:49:42 2018 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sat Sep 8 08:40:16 201814 // Update Count : 9713 // Last Modified On : Mon Dec 6 16:57:45 2021 14 // Update Count : 104 15 15 // 16 16 … … 48 48 if ( start == (void *)-1 ) { perror( "mmap" ); exit( EXIT_FAILURE ); }; 49 49 50 if ( char * cursor = strstr( start, ".Ldebug_info0:" ) ) { // debug information ?50 if ( char * dcursor = strstr( start, ".Ldebug_info0:" ) ) { // debug information ? 51 51 // Expand file by one byte to hold 2 character Cforall language code. 52 52 if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); }; 53 53 54 char * cursor = dcursor; 54 55 for ( int i = 0; i < 8; i += 1 ) { // move N (magic) lines forward 55 56 cursor = strstr( cursor, "\n" ) + 1; … … 57 58 58 59 cursor -= 2; // backup over "c\n" language value 59 if ( *(cursor - 1) != 'x' ) { fprintf( stderr, "invalid C language code\n" ); exit( EXIT_FAILURE ); }; 60 if ( *(cursor - 1) != 'x' ) { // 0x before code 61 fprintf( stderr, "*** ERROR *** Invalid C language code found in assembler file: %s\n" 62 "Assembler debug information:\n%.*s", 63 argv[argc - 1], (int)(cursor - dcursor) + 2, dcursor ); 64 exit( EXIT_FAILURE ); 65 }; 60 66 61 67 memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right
Note: See TracChangeset
for help on using the changeset viewer.