Simplifying GDB Scripts

Source: Internet
Author: User

Each debugging is first PS x|grep xxxx, then GDB attach pid, too troublesome! Write a rotten script to relieve yourself ~ ~ ~

1#!/bin/Bash2 3 #check num of argv4 5 if[[$#-ne1]]; Then6     Echo 'err:argv num!'7 Exit8 fi9 Ten#dealstring Onevar_argv=$1 AVar_name= 'Echo$var _argv|TR-D"/"`  -VAR_PID_NAME=${VAR_ARGV}'IM'${var_name} -  theRet_var= 'PS-X |grep$var _pid_name |grep-Vgrep|awk '{print $}'` -  -#stringto array -arr_out=() +Arr= (${ret_var/' '/ })   -    +  forIinch${arr[@]} A  Do   atarr_out[${#arr_out [@]}]=$i -  Done   -  -  -#Determines thatstringlength -  inLen_arr=${#arr_out [@]} -  to if[[$len _arr-ne1]]; Then +     Echo 'Too Manay pid!' -      forPidinch${arr_out[*]} the      Do   *         Echo$pid $      DonePanax Notoginseng Exit - fi the  + Echo 'Curpid:'$ret _var AGDB Attach $ret _var
View Code

Simplifying GDB Scripts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.