# GDB initialization script for Automotive RTOS debugging # Set target architecture set architecture arm set endian little # Configure remote target # target remote localhost:3333 # target remote :2331 # Set program counter set $pc = Reset_Handler # Break at main break main continue # RTOS-specific commands define rtos_tasks echo === RTOS Tasks ===\n set $task = task_list_head while $task != 0 printf "Task: %s\n", $task->name printf " ID: %d\n", $task->task_id printf " Priority: %d\n", $task->priority printf " State: %d\n", $task->state printf " Stack: 0x%08x\n", $task->stack_pointer printf " Stack Base: 0x%08x\n", $task->stack_base printf " Stack Size: %d\n", $task->stack_size printf "\n" set $task = $task->next end end define rtos_task_info if $argc != 1 echo Usage: rtos_task_info \n else set $task = task_list_head while $task != 0 if $_streq($task->name, $arg0) printf "Task Information:\n" printf " Name: %s\n", $task->name printf " ID: %d\n", $task->task_id printf " Priority: %d\n", $task->priority printf " State: %d\n", $task->state printf " Stack Pointer: 0x%08x\n", $task->stack_pointer printf " Stack Base: 0x%08x\n", $task->stack_base printf " Stack Size: %d\n", $task->stack_size printf " Stack Used: %d\n", $task->stack_high_water_mark printf " Execution Count: %d\n", $task->statistics.execution_count printf " Last Execution: %d\n", $task->statistics.last_execution_time break end set $task = $task->next end if $task == 0 echo Task not found\n end end end define rtos_scheduler_stats echo === Scheduler Statistics ===\n printf "Context Switches: %d\n", scheduler_state.statistics.context_switches printf "Preemptions: %d\n", scheduler_state.statistics.preemptions printf "Max Latency: %d\n", scheduler_state.statistics.max_scheduling_latency printf "Total Idle Time: %d\n", scheduler_state.statistics.total_idle_time end define rtos_semaphores echo === Semaphores ===\n # Iterate through semaphore list echo Semaphore information not available in this build\n end define rtos_mutexes echo === Mutexes ===\n # Iterate through mutex list echo Mutex information not available in this build\n end define rtos_queues echo === Message Queues ===\n # Iterate through queue list echo Queue information not available in this build\n end define rtos_stack_check echo === Stack Usage ===\n set $task = task_list_head while $task != 0 printf "%s: %d/%d bytes used\n", $task->name, $task->stack_high_water_mark, $task->stack_size set $task = $task->next end end # Pretty printing set print pretty on set print array on set print elements 20 set print demangle on # History set history save on set history size 1000 set history filename .gdb_history # Convenience set pagination off set confirm off set verbose off # Display on stop display/10i $pc