[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Allow remote(ish) debugging.



On 11/09/2009 10:24 AM, Hans de Goede wrote:
> Hmm,
> 
> The current SIGUSR2 behaviour is useful in various cases, can't we use
> another signal for
> this new functionality ?

Suggestions for which?

> 
> Regards,
> 
> Hans
> 
> 
> On 11/09/2009 04:16 PM, Peter Jones wrote:
>> This changes SIGUSR2 to start a debugger that you can telnet to on port
>> 8080.  At the moment you need to do "C-] mode char\n" in your telnet
>> client to get it into character mode instead of line mode.
>> ---
>>   anaconda             |   22 ++++++++++------------
>>   scripts/upd-instroot |    6 ++++--
>>   2 files changed, 14 insertions(+), 14 deletions(-)
>>
>> diff --git a/anaconda b/anaconda
>> index 2f0ca53..3046d43 100755
>> --- a/anaconda
>> +++ b/anaconda
>> @@ -443,6 +443,10 @@ def startSsh():
>>           os.execv("/sbin/sshd", args)
>>           sys.exit(1)
>>
>> +def startDebugger(signum, frame):
>> +    import epdb
>> +    epdb.serve(skip=1)
>> +
>>   class Anaconda:
>>       def __init__(self):
>>           self.intf = None
>> @@ -468,15 +472,6 @@ class Anaconda:
>>           # *sigh* we still need to be able to write this out
>>           self.xdriver = None
>>
>> -    def dumpState(self):
>> -        from exception import AnacondaExceptionDump
>> -        from inspect import stack as _stack
>> -        # Skip the frames for dumpState and the signal handler.
>> -        stack = _stack()[2:]
>> -        stack.reverse()
>> -        exn = AnacondaExceptionDump(None, None, stack)
>> -        exn.write(anaconda)
>> -
>>       def writeXdriver(self, instPath="/"):
>>           # this should go away at some point, but until it does, we
>>           # need to keep it around.  it could go into instdata but this
>> @@ -626,11 +621,14 @@ if __name__ == "__main__":
>>       signal.signal(signal.SIGINT, signal.SIG_DFL)
>>       signal.signal(signal.SIGSEGV, isys.handleSegv)
>>
>> -    # add our own additional signal handlers
>> -    signal.signal(signal.SIGUSR2, lambda signum, frame:
>> anaconda.dumpState())
>> -
>>       setupEnvironment()
>>
>> +    pidfile = open("/var/run/anaconda.pid", "w")
>> +    pidfile.write("%s\n" % (os.getpid(),))
>> +    del pidfile
>> +    # add our own additional signal handlers
>> +    signal.signal(signal.SIGUSR2, startDebugger)
>> +
>>       # we need to do this really early so we make sure its done
>> before rpm
>>       # is imported
>>       iutil.writeRpmPlatform()
>> diff --git a/scripts/upd-instroot b/scripts/upd-instroot
>> index c112787..a479f5a 100755
>> --- a/scripts/upd-instroot
>> +++ b/scripts/upd-instroot
>> @@ -185,12 +185,12 @@ PACKAGES="GConf2 NetworkManager ORBit2 acl anaconda
>>       openldap openssh openssh-server
>>       pam pango parted pciutils pcre psmisc
>>       pygtk2-libglade pykickstart pyparted python python-bugzilla
>> python-decorator
>> -    python-libs python-nss python-pyblock python-sqlite
>> +    python-libs python-nss python-pyblock python-sqlite python-epdb
>>       python-urlgrabber python-volume_key pyxf86config readline
>> redhat-artwork
>>       reiserfs-utils rpm rpm-libs rpm-python sed selinux-policy-targeted
>>       setup slang smc-meera-fonts specspo sqlite synaptics
>> system-config-date
>>       system-config-keyboard ${brandpkgname}-logos
>> ${brandpkgname}-release taipeifonts tcp_wrappers
>> -    sysvinit-tools
>> +    sysvinit-tools telnet
>>       tzdata udev un-core-dotum-fonts urw-fonts util-linux-ng
>> tigervnc-server
>>       tigervnc-server-module vlgothic-fonts vim-minimal
>>       wget wpa_supplicant xkeyboard-config xfsprogs xorg-x11-xauth
>> @@ -530,6 +530,7 @@ usr/bin/syslinux
>>   usr/bin/tac
>>   usr/bin/tail
>>   usr/bin/tee
>> +usr/bin/telnet
>>   usr/bin/tilo
>>   usr/bin/top
>>   usr/bin/wc
>> @@ -552,6 +553,7 @@ usr/lib/anaconda/storage/formats
>>   usr/lib/kernel-wrapper
>>   usr/lib/locale
>>   usr/lib/python?.?
>> +usr/lib/python?.?/site-packages/epdb/*.py
>>   usr/lib/rpm/macros
>>   usr/lib/rpm/rpmpopt
>>   usr/lib/rpm/rpmrc
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list


-- 
        Peter

In computing, turning the obvious into the useful is a living
definition of the word "frustration"
		-- Alan Perlis


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]