@@ -95,10 +95,9 @@ Debug::monodroid_profiler_load (const char *libmono_path, const char *desc, cons
95
95
96
96
if (!found)
97
97
log_warn (LOG_DEFAULT,
98
- std::format (" The '{}' profiler wasn't found in the main executable nor could it be loaded from '{}'." ,
99
- mname.get (),
100
- libname.get ()
101
- )
98
+ " The '{}' profiler wasn't found in the main executable nor could it be loaded from '{}'." ,
99
+ mname.get (),
100
+ libname.get ()
102
101
);
103
102
}
104
103
110
109
Debug::load_profiler (void *handle, const char *desc, const char *symbol)
111
110
{
112
111
ProfilerInitializer func = reinterpret_cast <ProfilerInitializer> (java_interop_lib_symbol (handle, symbol, nullptr ));
113
- log_warn (LOG_DEFAULT, std::format ( " Looking for profiler init symbol '{}'? {:p}" , symbol, reinterpret_cast <void *>(func) ));
112
+ log_warn (LOG_DEFAULT, " Looking for profiler init symbol '{}'? {:p}" , symbol, reinterpret_cast <void *>(func));
114
113
115
114
if (func != nullptr ) {
116
115
func (desc);
@@ -140,7 +139,7 @@ Debug::parse_options (char *options, ConnOptions *opts)
140
139
{
141
140
char **args, **ptr;
142
141
143
- log_info (LOG_DEFAULT, std::format ( " Connection options: '{}'" , options) );
142
+ log_info (LOG_DEFAULT, " Connection options: '{}'" , options);
144
143
145
144
args = Util::monodroid_strsplit (options, " ," , 0 );
146
145
@@ -150,12 +149,12 @@ Debug::parse_options (char *options, ConnOptions *opts)
150
149
if (strstr (arg, " port=" ) == arg) {
151
150
int port = atoi (arg + strlen (" port=" ));
152
151
if (port < 0 || port > std::numeric_limits<unsigned short >::max ()) {
153
- log_error (LOG_DEFAULT, std::format ( " Invalid debug port value {}" , port) );
152
+ log_error (LOG_DEFAULT, " Invalid debug port value {}" , port);
154
153
continue ;
155
154
}
156
155
157
156
conn_port = static_cast <uint16_t >(port);
158
- log_info (LOG_DEFAULT, std::format ( " XS port = {}" , conn_port) );
157
+ log_info (LOG_DEFAULT, " XS port = {}" , conn_port);
159
158
} else if (strstr (arg, " timeout=" ) == arg) {
160
159
char *endp;
161
160
@@ -164,7 +163,7 @@ Debug::parse_options (char *options, ConnOptions *opts)
164
163
if ((endp == arg) || (*endp != ' \0 ' ))
165
164
log_error (LOG_DEFAULT, " Invalid --timeout argument." sv);
166
165
} else {
167
- log_info (LOG_DEFAULT, std::format ( " Unknown connection option: '{}'" , arg) );
166
+ log_info (LOG_DEFAULT, " Unknown connection option: '{}'" , arg);
168
167
}
169
168
}
170
169
}
@@ -188,7 +187,7 @@ Debug::start_connection (char *options)
188
187
cur_time = time (nullptr );
189
188
190
189
if (opts.timeout_time && cur_time > opts.timeout_time ) {
191
- log_warn (LOG_DEBUGGER, std::format ( " Not connecting to IDE as the timeout value has been reached; current-time: {} timeout: {}" , cur_time, opts.timeout_time ) );
190
+ log_warn (LOG_DEBUGGER, " Not connecting to IDE as the timeout value has been reached; current-time: {} timeout: {}" , cur_time, opts.timeout_time );
192
191
return DebuggerConnectionStatus::Unconnected;
193
192
}
194
193
@@ -199,7 +198,7 @@ Debug::start_connection (char *options)
199
198
200
199
res = pthread_create (&conn_thread_id, nullptr , xamarin::android::conn_thread, this );
201
200
if (res) {
202
- log_error (LOG_DEFAULT, std::format ( " Failed to create connection thread: {}" , strerror (errno) ));
201
+ log_error (LOG_DEFAULT, " Failed to create connection thread: {}" , strerror (errno));
203
202
return DebuggerConnectionStatus::Error;
204
203
}
205
204
@@ -263,20 +262,20 @@ Debug::process_connection (int fd)
263
262
return false ;
264
263
}
265
264
if (rv <= 0 ) {
266
- log_info (LOG_DEFAULT, std::format ( " Error while receiving command from XS ({})" , strerror (errno) ));
265
+ log_info (LOG_DEFAULT, " Error while receiving command from XS ({})" , strerror (errno));
267
266
return false ;
268
267
}
269
268
270
269
rv = Util::recv_uninterrupted (fd, command, cmd_len);
271
270
if (rv <= 0 ) {
272
- log_info (LOG_DEFAULT, std::format ( " Error while receiving command from XS ({})" , strerror (errno) ));
271
+ log_info (LOG_DEFAULT, " Error while receiving command from XS ({})" , strerror (errno));
273
272
return false ;
274
273
}
275
274
276
275
// null-terminate
277
276
command [cmd_len] = 0 ;
278
277
279
- log_info (LOG_DEFAULT, std::format ( " Received cmd: '{}'." , command) );
278
+ log_info (LOG_DEFAULT, " Received cmd: '{}'." , command);
280
279
281
280
if (process_cmd (fd, command))
282
281
return true ;
@@ -288,14 +287,14 @@ Debug::handle_server_connection (void)
288
287
{
289
288
int listen_socket = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
290
289
if (listen_socket == -1 ) {
291
- log_info (LOG_DEFAULT, std::format ( " Could not create socket for XS to connect to: {}" , strerror (errno) ));
290
+ log_info (LOG_DEFAULT, " Could not create socket for XS to connect to: {}" , strerror (errno));
292
291
return 1 ;
293
292
}
294
293
295
294
int flags = 1 ;
296
295
int rv = setsockopt (listen_socket, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof (flags));
297
296
if (rv == -1 && Util::should_log (LOG_DEFAULT)) {
298
- log_info_nocheck (LOG_DEFAULT, std::format ( " Could not set SO_REUSEADDR on the listening socket ({})" , strerror (errno) ));
297
+ log_info_nocheck_fmt (LOG_DEFAULT, " Could not set SO_REUSEADDR on the listening socket ({})" , strerror (errno));
299
298
// not a fatal failure
300
299
}
301
300
@@ -309,7 +308,7 @@ Debug::handle_server_connection (void)
309
308
listen_addr.sin_addr .s_addr = INADDR_ANY;
310
309
rv = bind (listen_socket, (struct sockaddr *) &listen_addr, sizeof (listen_addr));
311
310
if (rv == -1 ) {
312
- log_info (LOG_DEFAULT, std::format ( " Could not bind to address: {}" , strerror (errno) ));
311
+ log_info (LOG_DEFAULT, " Could not bind to address: {}" , strerror (errno));
313
312
rv = 2 ;
314
313
goto cleanup;
315
314
}
@@ -321,7 +320,7 @@ Debug::handle_server_connection (void)
321
320
322
321
rv = listen (listen_socket, 1 );
323
322
if (rv == -1 ) {
324
- log_info (LOG_DEFAULT, std::format ( " Could not listen for XS: {}" , strerror (errno) ));
323
+ log_info (LOG_DEFAULT, " Could not listen for XS: {}" , strerror (errno));
325
324
rv = 2 ;
326
325
goto cleanup;
327
326
}
@@ -371,26 +370,26 @@ Debug::handle_server_connection (void)
371
370
} while (rv == -1 && errno == EINTR);
372
371
373
372
if (rv == -1 ) {
374
- log_info (LOG_DEFAULT, std::format ( " Failed while waiting for XS to connect: {}" , strerror (errno) ));
373
+ log_info (LOG_DEFAULT, " Failed while waiting for XS to connect: {}" , strerror (errno));
375
374
rv = 2 ;
376
375
goto cleanup;
377
376
}
378
377
379
378
socklen_t len = sizeof (struct sockaddr_in );
380
379
int fd = accept (listen_socket, (struct sockaddr *) &listen_addr, &len);
381
380
if (fd == -1 ) {
382
- log_info (LOG_DEFAULT, std::format ( " Failed to accept connection from XS: {}" , strerror (errno) ));
381
+ log_info (LOG_DEFAULT, " Failed to accept connection from XS: {}" , strerror (errno));
383
382
rv = 3 ;
384
383
goto cleanup;
385
384
}
386
385
387
386
flags = 1 ;
388
387
if (setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flags, sizeof (flags)) < 0 ) {
389
- log_info (LOG_DEFAULT, std::format ( " Could not set TCP_NODELAY on socket ({})" , strerror (errno) ));
388
+ log_info (LOG_DEFAULT, " Could not set TCP_NODELAY on socket ({})" , strerror (errno));
390
389
// not a fatal failure
391
390
}
392
391
393
- log_info (LOG_DEFAULT, std::format ( " Successfully received connection from XS on port {}, fd: {}" , listen_port, fd) );
392
+ log_info (LOG_DEFAULT, " Successfully received connection from XS on port {}, fd: {}" , listen_port, fd);
394
393
395
394
need_new_conn = process_connection (fd);
396
395
}
@@ -442,7 +441,7 @@ Debug::process_cmd (int fd, char *cmd)
442
441
constexpr std::string_view PONG_REPLY { " pong" };
443
442
if (strcmp (cmd, PING_CMD.data ()) == 0 ) {
444
443
if (!Util::send_uninterrupted (fd, const_cast <void *> (reinterpret_cast <const void *> (PONG_REPLY.data ())), 5 ))
445
- log_error (LOG_DEFAULT, std::format ( " Got keepalive request from XS, but could not send response back ({})" , strerror (errno) ));
444
+ log_error (LOG_DEFAULT, " Got keepalive request from XS, but could not send response back ({})" , strerror (errno));
446
445
return false ;
447
446
}
448
447
@@ -488,7 +487,7 @@ Debug::process_cmd (int fd, char *cmd)
488
487
profiler_fd = fd;
489
488
profiler_description = Util::monodroid_strdup_printf (" %s,output=#%i" , prof, profiler_fd);
490
489
} else {
491
- log_error (LOG_DEFAULT, std::format ( " Unknown profiler: '{}'" , prof) );
490
+ log_error (LOG_DEFAULT, " Unknown profiler: '{}'" , prof);
492
491
}
493
492
/* Notify the main thread (start_profiling ()) */
494
493
profiler_configured = true ;
@@ -497,7 +496,7 @@ Debug::process_cmd (int fd, char *cmd)
497
496
pthread_mutex_unlock (&process_cmd_mutex);
498
497
return use_fd;
499
498
} else {
500
- log_error (LOG_DEFAULT, std::format ( " Unsupported command: '{}'" , cmd) );
499
+ log_error (LOG_DEFAULT, " Unsupported command: '{}'" , cmd);
501
500
}
502
501
503
502
return false ;
@@ -527,7 +526,7 @@ Debug::start_debugging (void)
527
526
528
527
// this text is used in unit tests to check the debugger started
529
528
// do not change it without updating the test.
530
- log_warn (LOG_DEBUGGER, std::format ( " Trying to initialize the debugger with options: {}" , debug_arg) );
529
+ log_warn (LOG_DEBUGGER, " Trying to initialize the debugger with options: {}" , debug_arg);
531
530
532
531
if (enable_soft_breakpoints ()) {
533
532
constexpr std::string_view soft_breakpoints { " --soft-breakpoints" };
@@ -554,7 +553,7 @@ Debug::start_profiling ()
554
553
if (!profiler_description)
555
554
return ;
556
555
557
- log_info (LOG_DEFAULT, std::format ( " Loading profiler: '{}'" , profiler_description) );
556
+ log_info (LOG_DEFAULT, " Loading profiler: '{}'" , profiler_description);
558
557
monodroid_profiler_load (AndroidSystem::get_runtime_libdir (), profiler_description, nullptr );
559
558
}
560
559
@@ -574,25 +573,25 @@ Debug::enable_soft_breakpoints (void)
574
573
uname (&name);
575
574
for (const char ** ptr = soft_breakpoint_kernel_list; *ptr; ptr++) {
576
575
if (strcmp (name.release , *ptr) == 0 ) {
577
- log_info (LOG_DEBUGGER, std::format ( " soft breakpoints enabled due to kernel version match ({})" , name.release ) );
576
+ log_info (LOG_DEBUGGER, " soft breakpoints enabled due to kernel version match ({})" , name.release );
578
577
return 1 ;
579
578
}
580
579
}
581
580
582
581
char *value;
583
582
/* Soft breakpoints are enabled by default */
584
583
if (AndroidSystem::monodroid_get_system_property (SharedConstants::DEBUG_MONO_SOFT_BREAKPOINTS, &value) <= 0 ) {
585
- log_info (LOG_DEBUGGER, std::format ( " soft breakpoints enabled by default ({} property not defined)" , SharedConstants::DEBUG_MONO_SOFT_BREAKPOINTS.data () ));
584
+ log_info (LOG_DEBUGGER, " soft breakpoints enabled by default ({} property not defined)" , SharedConstants::DEBUG_MONO_SOFT_BREAKPOINTS.data ());
586
585
return 1 ;
587
586
}
588
587
589
588
bool ret;
590
589
if (strcmp (" 0" , value) == 0 ) {
591
590
ret = false ;
592
- log_info (LOG_DEBUGGER, std::format ( " soft breakpoints disabled ({} property set to {})" , SharedConstants::DEBUG_MONO_SOFT_BREAKPOINTS.data (), value) );
591
+ log_info (LOG_DEBUGGER, " soft breakpoints disabled ({} property set to {})" , SharedConstants::DEBUG_MONO_SOFT_BREAKPOINTS.data (), value);
593
592
} else {
594
593
ret = true ;
595
- log_info (LOG_DEBUGGER, std::format ( " soft breakpoints enabled ({} property set to {})" , SharedConstants::DEBUG_MONO_SOFT_BREAKPOINTS.data (), value) );
594
+ log_info (LOG_DEBUGGER, " soft breakpoints enabled ({} property set to {})" , SharedConstants::DEBUG_MONO_SOFT_BREAKPOINTS.data (), value);
596
595
}
597
596
delete[] value;
598
597
return ret;
0 commit comments