@@ -28,10 +28,6 @@ import { compareVersions } from '../util/compareVersions';
2828import { isProcessActive } from '../util/processes' ;
2929import { NamedLogger } from '../namedLogger' ;
3030
31- // Error as returned by GDB when calling 'set charset' without argument
32- const CHARSETS_ERROR_REGEXP =
33- / R e q u i r e s a n a r g u m e n t . V a l i d a r g u m e n t s a r e ( .+ ) \. / ;
34-
3531type WriteCallback = ( error : Error | null | undefined ) => void ;
3632
3733export class GDBBackend extends events . EventEmitter implements IGDBBackend {
@@ -61,49 +57,6 @@ export class GDBBackend extends events.EventEmitter implements IGDBBackend {
6157 return this . varMgr ;
6258 }
6359
64- /**
65- * Detect list of supported charsets by provoking error from GDB
66- * which returns the list.
67- */
68- private async getSupportedCharsets ( ) : Promise < string [ ] > {
69- let charsetString : string | undefined ;
70- try {
71- // Provoke error by missing argument
72- await this . sendGDBSet ( 'charset' ) ;
73- } catch ( error ) {
74- const errMessage = ( error as Error ) ?. message ;
75- if ( errMessage ) {
76- const matches = CHARSETS_ERROR_REGEXP . exec ( errMessage ) ;
77- charsetString = matches ? matches [ 1 ] : undefined ;
78- }
79- }
80- if ( ! charsetString ) {
81- return [ ] ;
82- }
83- const charsets = charsetString
84- . split ( ',' )
85- . map ( ( charset ) => charset . trim ( ) ) ;
86- return charsets ;
87- }
88-
89- /**
90- * Detect if to apply UTF-8 decoding based on detecting available
91- * charsets in GDB.
92- *
93- * Return 'false' if only CP1252 (ASCII) and 'auto' like for some
94- * GDB variants for embedded on Windows.
95- * Note: Strictly speaking Windows-only, but keep this method OS
96- * agnostic to avoid potential trouble with web use-case.
97- */
98- private async shouldDecodeUTF8 ( ) : Promise < boolean > {
99- const supportedCharsets = await this . getSupportedCharsets ( ) ;
100- return ! (
101- supportedCharsets . length === 2 &&
102- supportedCharsets . includes ( 'CP1252' ) &&
103- supportedCharsets . includes ( 'auto' )
104- ) ;
105- }
106-
10760 public async spawn (
10861 requestArgs : LaunchRequestArguments | AttachRequestArguments
10962 ) {
@@ -139,9 +92,6 @@ export class GDBBackend extends events.EventEmitter implements IGDBBackend {
13992 this . asyncRequestedExplicitly = ! ! (
14093 requestArgs . gdbAsync || requestArgs . gdbNonStop
14194 ) ;
142- if ( ! ( await this . shouldDecodeUTF8 ( ) ) ) {
143- this . parser . decodeUtf8 = false ;
144- }
14595 await this . setNonStopMode ( requestArgs . gdbNonStop ) ;
14696 await this . setAsyncMode ( requestArgs . gdbAsync ) ;
14797 }
0 commit comments