Skip to content

Instantly share code, notes, and snippets.

@dbalan
Created April 16, 2013 18:08
Show Gist options
  • Save dbalan/5398145 to your computer and use it in GitHub Desktop.
Save dbalan/5398145 to your computer and use it in GitHub Desktop.
RTEMS GDB Python
diff rtems-20100326/objects.py /home/dhananjay/Downloads/rtems-20100326/objects.py
64a65,67
> return self.object_return(api, _class, index)
>
> def object_return(self, api, _class, index):
99c102
< 'class': (27, 31) }
---
> 'class': (27, 31) }
150c153
<
---
>
diff rtems-20100326/rtems.py /home/dhananjay/Downloads/rtems-20100326/rtems.py
80c80
< super(rtems_object, self).__init__('rtems object',
---
> super(rtems_object, self).__init__('rtems object',
84a85
> print num
101,102c102,134
<
< #
---
>
> class rtems_semaphore(gdb.Command):
> "List all the classic semaphores"
>
> api = 'classic'
> _class = 'semaphores'
>
> def __init__(self):
> self.__doc__ = 'Display the RTEMS classic semaphores.'
> super(rtems_semaphore, self).__init__('rtems semaphores',
> gdb.COMMAND_STATUS)
>
> def invoke(self,arg, from_tty):
> max = objects.information.maximum(self.api, self._class)
>
> i = 0
> while i < max:
> print "Index is "+str(i)
> pt = objects.information.object_return(self.api,self._class, i)
> if pt != 0:
> # Duplication of work - refactering of flow needed
> val = int(pt['Object']['id'])
> num = gdb.parse_and_eval(str(val))
> id = objects.ident(int(pt['Object']['id']))
> object = classic.semaphore(id)
> try:
> object.show(from_tty)
> except NameError:
> pass
> i = i+1
> objects.information.invalidate()
>
>
110a143
> rtems_semaphore()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment