- Timestamp:
- Dec 7, 2021, 5:01:23 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 130a778
- Parents:
- 75873cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
driver/as.cc
r75873cf r63f2697 11 11 // Created On : Wed Aug 1 10:49:42 2018 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Tue Dec 7 1 0:03:34 202114 // Update Count : 1 0813 // Last Modified On : Tue Dec 7 16:56:24 2021 14 // Update Count : 115 15 15 // 16 16 … … 48 48 if ( start == (void *)-1 ) { perror( "mmap" ); exit( EXIT_FAILURE ); }; 49 49 50 if ( char * dcursor = strstr( start, ".Ldebug_info0:" ) ) { // debug information ? 51 // Expand file by one byte to hold 2 character Cforall language code. 52 if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); }; 50 char * dcursor; 51 if ( (dcursor = strstr( start, ".Ldebug_info0:" ) ) ) { // debug information ? 53 52 54 char * cursor = dcursor; 55 for ( int i = 0; i < 8; i += 1 ) { // move N (magic) lines forward 56 cursor = strstr( cursor, "\n" ) + 1; 57 } // for 58 59 cursor -= 2; // backup over "c\n" language value 60 if ( *(cursor - 1) != 'x' ) { // 0x before code 61 for ( int i = 0; i < 8; i += 1 ) { // move N (magic) lines forward 53 if ( char * cursor = strstr( dcursor, ".long\t.LASF" ) ) { // debug information ? 54 for ( int i = 0; i < 2; i += 1 ) { // move N (magic) lines forward 62 55 cursor = strstr( cursor, "\n" ) + 1; 63 56 } // for 64 fprintf( stderr, "*** ERROR *** Invalid C language code found in assembler file: %s\n"65 "Assembler debug information:\n%.*s",66 argv[argc - 1], (int)(cursor - dcursor) + 2, dcursor );67 exit( EXIT_FAILURE );68 };69 57 70 memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right 58 cursor -= 2; // backup over "c\n" language value 59 if ( *(cursor - 1) != 'x' ) { // 0x before code 60 for ( int i = 0; i < 6; i += 1 ) { // move N (magic) lines forward 61 cursor = strstr( cursor, "\n" ) + 1; 62 } // for 63 fprintf( stderr, "*** ERROR *** Invalid C language code found in assembler file: %s\n" 64 "Assembler debug information:\n%.*s", 65 argv[argc - 1], (int)(cursor - dcursor), dcursor ); 66 exit( EXIT_FAILURE ); 67 }; 71 68 72 *(cursor) = '2'; // replace C language value with CFA 73 *(cursor + 1) = '5'; 69 // Expand file by one byte to hold 2 character Cforall language code. 70 if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); }; 71 72 memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right 73 74 *(cursor) = '2'; // replace C language value with CFA 75 *(cursor + 1) = '5'; 76 } // if 74 77 } // if 75 78
Note: See TracChangeset
for help on using the changeset viewer.