Skip to content

Commit

Permalink
Multiple terminals
Browse files Browse the repository at this point in the history
  • Loading branch information
marcsosduma committed Dec 2, 2023
1 parent a4f8511 commit 84045ac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,6 @@ Add `gdbtty` property to your `launch.json`. Here’s an example:
```
![GdbTTY](gdbttydisplay.png)

* Linux Requirements: `xterm`

How to install xterm on Ubuntu:
```
sudo apt-get install xterm
```

On Linux you can see the output of the application in Vs Code itself. Add `gdbtty` property with `vscode` value to your `launch.json`. Here is an example:
```json
{
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
true,
false,
"vscode",
"xterm",
"gnome-terminal",
"xfce4-terminal",
"konsole",
"external"
]
}
Expand Down
40 changes: 31 additions & 9 deletions src/mi2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ export class MI2 extends EventEmitter implements IDebugger {
try_find++;
if (xterm_device != "") break;
}
if (xterm_device === "") this.log("stderr", "tty: Install 'xterm' to use gdb's tty option\n");
if (xterm_device === "") this.log("stderr", "tty: Install a terminal to use gdb's tty option\n");
}
if (xterm_device.includes("pts")) {
this.gdbArgs.push("--tty=" + xterm_device);
Expand Down Expand Up @@ -1194,15 +1194,37 @@ export class MI2 extends EventEmitter implements IDebugger {

// Opens a terminal to show the application screen - gdbtty
createTerminal(gdbtty, sleepVal, target) {
let findTerminal = true;
if (gdbtty != "vscode") {
if(this.isTerminalInstalled("xterm")){
this.createXtermTerminal(sleepVal, target);
}else if(this.isTerminalInstalled("gnome-terminal")){
this.createGNOMETerminal(sleepVal, target);
}else if(this.isTerminalInstalled("konsole")){
this.createKDETerminal(sleepVal, target);
}else if(this.isTerminalInstalled("xfce4-terminal")){
this.createXFCETerminal(sleepVal, target);
if (typeof gdbtty === 'string' && gdbtty!="external") {
if(this.isTerminalInstalled(gdbtty)){
findTerminal = false;
switch (gdbtty) {
case "xterm":
this.createXtermTerminal(sleepVal, target);
break;
case "gnome-terminal":
this.createGNOMETerminal(sleepVal, target);
break;
case "konsole":
this.createKDETerminal(sleepVal, target);
break;
case "xfce4-terminal":
this.createXFCETerminal(sleepVal, target);
break;
}
}
}
if(findTerminal){
if(this.isTerminalInstalled("xterm")){
this.createXtermTerminal(sleepVal, target);
}else if(this.isTerminalInstalled("gnome-terminal")){
this.createGNOMETerminal(sleepVal, target);
}else if(this.isTerminalInstalled("konsole")){
this.createKDETerminal(sleepVal, target);
}else if(this.isTerminalInstalled("xfce4-terminal")){
this.createXFCETerminal(sleepVal, target);
}
}
} else {
let terminal = this.selectTerminal();
Expand Down

0 comments on commit 84045ac

Please sign in to comment.