db_script.c (174919) | db_script.c (283248) |
---|---|
1/*- 2 * Copyright (c) 2007 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 40 unchanged lines hidden (view full) --- 49 * flexibility and avoiding hard-defined buffer limits. 50 * - When scripts run automatically on entrance to DDB, placing "continue" at 51 * the end still results in being in the debugger, as we unconditionally 52 * run db_command_loop() after the script. There should be a way to avoid 53 * this. 54 */ 55 56#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 40 unchanged lines hidden (view full) --- 49 * flexibility and avoiding hard-defined buffer limits. 50 * - When scripts run automatically on entrance to DDB, placing "continue" at 51 * the end still results in being in the debugger, as we unconditionally 52 * run db_command_loop() after the script. There should be a way to avoid 53 * this. 54 */ 55 56#include <sys/cdefs.h> |
57__FBSDID("$FreeBSD: head/sys/ddb/db_script.c 174919 2007-12-26 10:51:07Z rwatson $"); | 57__FBSDID("$FreeBSD: head/sys/ddb/db_script.c 283248 2015-05-21 15:16:18Z pfg $"); |
58 59#include <sys/param.h> 60#include <sys/kdb.h> 61#include <sys/kernel.h> 62#include <sys/libkern.h> 63#include <sys/lock.h> 64#include <sys/malloc.h> 65#include <sys/mutex.h> --- 268 unchanged lines hidden (view full) --- 334 * script <scriptname> <script> - set a script 335 * unscript <scriptname> - remove a script 336 */ 337 338/* 339 * List scripts and their contents. 340 */ 341void | 58 59#include <sys/param.h> 60#include <sys/kdb.h> 61#include <sys/kernel.h> 62#include <sys/libkern.h> 63#include <sys/lock.h> 64#include <sys/malloc.h> 65#include <sys/mutex.h> --- 268 unchanged lines hidden (view full) --- 334 * script <scriptname> <script> - set a script 335 * unscript <scriptname> - remove a script 336 */ 337 338/* 339 * List scripts and their contents. 340 */ 341void |
342db_scripts_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, | 342db_scripts_cmd(db_expr_t addr, bool have_addr, db_expr_t count, |
343 char *modif) 344{ 345 int i; 346 347 for (i = 0; i < DB_MAXSCRIPTS; i++) { 348 if (strlen(db_script_table[i].ds_scriptname) != 0) { 349 db_printf("%s=%s\n", 350 db_script_table[i].ds_scriptname, 351 db_script_table[i].ds_script); 352 } 353 } 354} 355 356/* 357 * Execute a script. 358 */ 359void | 343 char *modif) 344{ 345 int i; 346 347 for (i = 0; i < DB_MAXSCRIPTS; i++) { 348 if (strlen(db_script_table[i].ds_scriptname) != 0) { 349 db_printf("%s=%s\n", 350 db_script_table[i].ds_scriptname, 351 db_script_table[i].ds_script); 352 } 353 } 354} 355 356/* 357 * Execute a script. 358 */ 359void |
360db_run_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif) | 360db_run_cmd(db_expr_t addr, bool have_addr, db_expr_t count, char *modif) |
361{ 362 int t; 363 364 /* 365 * Right now, we accept exactly one argument. In the future, we 366 * might want to accept flags and arguments to the script itself. 367 */ 368 t = db_read_token(); --- 7 unchanged lines hidden (view full) --- 376} 377 378/* 379 * Print or set a named script, with the set portion broken out into its own 380 * function. We must directly access the remainder of the DDB line input as 381 * we do not wish to use db_lex's token processing. 382 */ 383void | 361{ 362 int t; 363 364 /* 365 * Right now, we accept exactly one argument. In the future, we 366 * might want to accept flags and arguments to the script itself. 367 */ 368 t = db_read_token(); --- 7 unchanged lines hidden (view full) --- 376} 377 378/* 379 * Print or set a named script, with the set portion broken out into its own 380 * function. We must directly access the remainder of the DDB line input as 381 * we do not wish to use db_lex's token processing. 382 */ 383void |
384db_script_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, | 384db_script_cmd(db_expr_t addr, bool have_addr, db_expr_t count, |
385 char *modif) 386{ 387 char *buf, scriptname[DB_MAXSCRIPTNAME]; 388 struct ddb_script *dsp; 389 int error, t; 390 391 t = db_read_token(); 392 if (t != tIDENT) { --- 29 unchanged lines hidden (view full) --- 422 db_printf("?\n"); 423 db_skip_to_eol(); 424} 425 426/* 427 * Remove a named script. 428 */ 429void | 385 char *modif) 386{ 387 char *buf, scriptname[DB_MAXSCRIPTNAME]; 388 struct ddb_script *dsp; 389 int error, t; 390 391 t = db_read_token(); 392 if (t != tIDENT) { --- 29 unchanged lines hidden (view full) --- 422 db_printf("?\n"); 423 db_skip_to_eol(); 424} 425 426/* 427 * Remove a named script. 428 */ 429void |
430db_unscript_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, | 430db_unscript_cmd(db_expr_t addr, bool have_addr, db_expr_t count, |
431 char *modif) 432{ 433 int error, t; 434 435 t = db_read_token(); 436 if (t != tIDENT) { 437 db_printf("?\n"); 438 db_skip_to_eol(); --- 124 unchanged lines hidden --- | 431 char *modif) 432{ 433 int error, t; 434 435 t = db_read_token(); 436 if (t != tIDENT) { 437 db_printf("?\n"); 438 db_skip_to_eol(); --- 124 unchanged lines hidden --- |