Install and configure stack trace debugging libraries.
(
arguments: dict[str, Any], project_root: Path
)
| 1255 | |
| 1256 | |
| 1257 | async def setup_stack_traces( |
| 1258 | arguments: dict[str, Any], project_root: Path |
| 1259 | ) -> CallToolResult: |
| 1260 | """Install and configure stack trace debugging libraries.""" |
| 1261 | method = arguments.get("method", "auto") |
| 1262 | test_installation = arguments.get("test_installation", True) |
| 1263 | install_only = arguments.get("install_only", False) |
| 1264 | |
| 1265 | result_text = "# FastLED Stack Trace Setup\n\n" |
| 1266 | |
| 1267 | try: |
| 1268 | # Detect OS and package manager |
| 1269 | import platform |
| 1270 | |
| 1271 | system = platform.system().lower() |
| 1272 | |
| 1273 | if system == "linux": |
| 1274 | # Try to detect package manager |
| 1275 | distro_info = "" |
| 1276 | try: |
| 1277 | with open("/etc/os-release", "r") as f: |
| 1278 | distro_info = f.read().lower() |
| 1279 | except (OSError, IOError): |
| 1280 | pass |
| 1281 | |
| 1282 | install_commands: list[str] = [] |
| 1283 | |
| 1284 | if method in ["libunwind", "auto"]: |
| 1285 | result_text += "## Installing LibUnwind (Enhanced Stack Traces)\n\n" |
| 1286 | |
| 1287 | if "ubuntu" in distro_info or "debian" in distro_info: |
| 1288 | install_commands.append("sudo apt-get update") |
| 1289 | install_commands.append( |
| 1290 | "sudo apt-get install -y libunwind-dev build-essential" |
| 1291 | ) |
| 1292 | elif "centos" in distro_info or "rhel" in distro_info: |
| 1293 | install_commands.append( |
| 1294 | "sudo yum install -y libunwind-devel gcc-c++" |
| 1295 | ) |
| 1296 | elif "fedora" in distro_info: |
| 1297 | install_commands.append( |
| 1298 | "sudo dnf install -y libunwind-devel gcc-c++" |
| 1299 | ) |
| 1300 | else: |
| 1301 | result_text += ( |
| 1302 | "⚠️ Unknown Linux distribution. Manual installation required.\n" |
| 1303 | ) |
| 1304 | result_text += ( |
| 1305 | "Common package names: libunwind-dev, libunwind-devel\n\n" |
| 1306 | ) |
| 1307 | |
| 1308 | elif method == "execinfo": |
| 1309 | result_text += "## Using Execinfo (Standard GCC Stack Traces)\n\n" |
| 1310 | result_text += "[OK] Execinfo is part of glibc - no additional packages needed!\n\n" |
| 1311 | |
| 1312 | # Still need build tools |
| 1313 | if "ubuntu" in distro_info or "debian" in distro_info: |
| 1314 | install_commands.append("sudo apt-get update") |
no test coverage detected