|
31 | 31 | using namespace lldb_private;
|
32 | 32 | using namespace lldb_private::line_editor;
|
33 | 33 |
|
34 |
| -// Workaround for what looks like an OS X-specific issue, but other platforms |
35 |
| -// may benefit from something similar if issues arise. The libedit library |
36 |
| -// doesn't explicitly initialize the curses termcap library, which it gets away |
37 |
| -// with until TERM is set to VT100 where it stumbles over an implementation |
38 |
| -// assumption that may not exist on other platforms. The setupterm() function |
39 |
| -// would normally require headers that don't work gracefully in this context, |
40 |
| -// so the function declaration has been hoisted here. |
41 |
| -#if defined(__APPLE__) |
42 |
| -extern "C" { |
43 |
| -int setupterm(char *term, int fildes, int *errret); |
44 |
| -} |
45 |
| -#define USE_SETUPTERM_WORKAROUND |
46 |
| -#endif |
47 |
| - |
48 | 34 | // Editline uses careful cursor management to achieve the illusion of editing a
|
49 | 35 | // multi-line block of text with a single line editor. Preserving this
|
50 | 36 | // illusion requires fairly careful management of cursor state. Read and
|
@@ -1402,35 +1388,6 @@ Editline::Editline(const char *editline_name, FILE *input_file,
|
1402 | 1388 | // Get a shared history instance
|
1403 | 1389 | m_editor_name = (editline_name == nullptr) ? "lldb-tmp" : editline_name;
|
1404 | 1390 | m_history_sp = EditlineHistory::GetHistory(m_editor_name);
|
1405 |
| - |
1406 |
| -#ifdef USE_SETUPTERM_WORKAROUND |
1407 |
| - if (m_output_file) { |
1408 |
| - const int term_fd = fileno(m_output_file); |
1409 |
| - if (term_fd != -1) { |
1410 |
| - static std::recursive_mutex *g_init_terminal_fds_mutex_ptr = nullptr; |
1411 |
| - static std::set<int> *g_init_terminal_fds_ptr = nullptr; |
1412 |
| - static llvm::once_flag g_once_flag; |
1413 |
| - llvm::call_once(g_once_flag, [&]() { |
1414 |
| - g_init_terminal_fds_mutex_ptr = |
1415 |
| - new std::recursive_mutex(); // NOTE: Leak to avoid C++ destructor |
1416 |
| - // chain issues |
1417 |
| - g_init_terminal_fds_ptr = new std::set<int>(); // NOTE: Leak to avoid |
1418 |
| - // C++ destructor chain |
1419 |
| - // issues |
1420 |
| - }); |
1421 |
| - |
1422 |
| - // We must make sure to initialize the terminal a given file descriptor |
1423 |
| - // only once. If we do this multiple times, we start leaking memory. |
1424 |
| - std::lock_guard<std::recursive_mutex> guard( |
1425 |
| - *g_init_terminal_fds_mutex_ptr); |
1426 |
| - if (g_init_terminal_fds_ptr->find(term_fd) == |
1427 |
| - g_init_terminal_fds_ptr->end()) { |
1428 |
| - g_init_terminal_fds_ptr->insert(term_fd); |
1429 |
| - setupterm((char *)0, term_fd, (int *)0); |
1430 |
| - } |
1431 |
| - } |
1432 |
| - } |
1433 |
| -#endif |
1434 | 1391 | }
|
1435 | 1392 |
|
1436 | 1393 | Editline::~Editline() {
|
|
0 commit comments