Bugzilla – Attachment 43844 Details for
Bug 34745
Implementation of python gdb helpers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Work in progress unit test for gdb python prettyprinting hooks for (String*)
selftest.py (text/plain), 3.08 KB, created by
Dave Malcolm
on 2011-02-25 17:17:48 UTC
(
hide
)
Description:
Work in progress unit test for gdb python prettyprinting hooks for (String*)
Filename:
MIME Type:
Creator:
Dave Malcolm
Created:
2011-02-25 17:17:48 UTC
Size:
3.08 KB
patch
obsolete
>import unittest >import subprocess >import re > >class DebuggerTests(unittest.TestCase): > > """Test that the gdb integration works""" > > def run_gdb(self, *args): > """Runs gdb with the command line given by *args. > > Returns its stdout, stderr > """ > out, err = subprocess.Popen( > args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, > ).communicate() > return out, err > > def run_under_gdb(self, executable): > # We use "set breakpoint pending yes" to avoid blocking with a: > # Function "foo" not defined. > # Make breakpoint pending on future shared library load? (y or [n]) > > commands = ['set breakpoint pending yes', > 'break Application::Yield', > 'run', > 'up', > # at this point, we should be within Application::Execute() > # with "pSVData" set up. > > # FIXME: automate registration of the debug hooks: > 'python import libreoffice', > > # Verify prettyprinting of a (String*), as $1 > 'print pSVData->maAppData->mpAppName', > > # Manually fake a NULL (String*): > 'set pSVData->maAppData->mpAppName = 0', > # and verify prettyprinting it (as $2) > 'print pSVData->maAppData->mpAppName'] > > # print commands > > # Use "commands" to generate the arguments with which to invoke "gdb": > args = ["gdb", "--batch"] > args += ['--eval-command=%s' % cmd for cmd in commands] > args += ["--args", executable] > > if False: > print args > print ' '.join(args) > > # Use "args" to invoke gdb, capturing stdout, stderr: > out, err = self.run_gdb(*args) > > if False: > print out, err > > # Ignore some noise on stderr due to the pending breakpoint: > err = err.replace('Function "Application::Yield" not defined.\n', '') > err = err.replace('Can\'t find member of namespace, class, struct, or union named "Application::Yield"\n' > 'Hint: try \'Application::Yield<TAB> or \'Application::Yield<ESC-?>\n' > '(Note leading single quote.)\n', > '') > errlines = err.splitlines() > err = '' > for errline in errlines: > if re.match('Detaching after fork from child process [0-9]+', errline): > continue > > if errline.endswith('separate debug info file has no debug info'): > continue > > err += errline + '\n' > > # Ensure no unexpected error messages: > self.assertEqual(err, '') > > return out > > def test_string_prettyprinter(self): > out = self.run_under_gdb('/usr/lib64/openoffice.org3/program/simpress.bin') # FIXME > if False: > print out > self.assert_("$1 = String('soffice')\n" in out, > msg=out) > self.assert_("$2 = NULL\n" in out, > msg=out) > >if __name__ == '__main__': > unittest.main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 34745
:
43843
| 43844 |
44461