File tree 1 file changed +24
-2
lines changed
1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -723,6 +723,28 @@ emit_line_number_info_begin (MonoDwarfWriter *w)
723
723
emit_label (w , ".Ldebug_line_end" );
724
724
}
725
725
726
+ static char *
727
+ escape_path (char * name )
728
+ {
729
+ if (strchr (name , '\\' )) {
730
+ char * s = g_malloc (strlen (name ) * 2 );
731
+ int len , i , j ;
732
+
733
+ len = strlen (name );
734
+ j = 0 ;
735
+ for (i = 0 ; i < len ; ++ i ) {
736
+ if (name [i ] == '\\' ) {
737
+ s [j ++ ] = '\\' ;
738
+ s [j ++ ] = '\\' ;
739
+ } else {
740
+ s [j ++ ] = name [i ];
741
+ }
742
+ }
743
+ return s ;
744
+ }
745
+ return name ;
746
+ }
747
+
726
748
static void
727
749
emit_all_line_number_info (MonoDwarfWriter * w )
728
750
{
@@ -810,7 +832,7 @@ emit_all_line_number_info (MonoDwarfWriter *w)
810
832
for (i = 0 ; i < w -> line_number_dir_index ; ++ i ) {
811
833
char * dir = g_hash_table_lookup (index_to_dir , GUINT_TO_POINTER (i + 1 ));
812
834
813
- emit_string (w , dir );
835
+ emit_string (w , escape_path ( dir ) );
814
836
}
815
837
/* End of Includes */
816
838
emit_byte (w , 0 );
@@ -831,7 +853,7 @@ emit_all_line_number_info (MonoDwarfWriter *w)
831
853
if (basename )
832
854
emit_string (w , basename );
833
855
else
834
- emit_string (w , name );
856
+ emit_string (w , escape_path ( name ) );
835
857
emit_uleb128 (w , dir_index );
836
858
emit_byte (w , 0 );
837
859
emit_byte (w , 0 );
You can’t perform that action at this time.
0 commit comments