Repository: pwndbg/pwndbg

Issue:
Broken `entry` command
### Description

The `entry` command pass arguments differently then the `run` command.

### Steps to reproduce

```
[dc@dc:pwndbg|dev *$%]$ gdb python
Loaded 113 commands. Type pwndbg [filter] for a list.
Reading symbols from python...(no debugging symbols found)...done.
pwndbg> set exception-verbose on
Set whether to print a full stacktracefor exceptions raised in Pwndbg commands to True
pwndbg> run -c "print(1); print(2)"
Starting program: /usr/bin/python -c "print(1); print(2)"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
1
2
[Inferior 1 (process 20590) exited normally]
pwndbg> entry -c "print(1); print(2)"
('-c', 'print(1); print(2)')
Running '%s' run -c print(1); print(2)
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `exec /usr/bin/python -c print(1); print(2)'
Traceback (most recent call last):
  File "/home/dc/installed/pwndbg/pwndbg/commands/__init__.py", line 100, in __call__
    return self.function(*args, **kwargs)
  File "/home/dc/installed/pwndbg/pwndbg/commands/__init__.py", line 181, in _OnlyWithFile
    return function(*a, **kw)
  File "/home/dc/installed/pwndbg/pwndbg/commands/start.py", line 72, in entry
    gdb.execute(run, from_tty=False)
gdb.error: During startup program exited with code 1.

If that is an issue, you can report it on https://github.com/pwndbg/pwndbg/issues
(Please don't forget to search if it hasn't been reported before)
PS: Pull requests are welcome
```

### My version

```
pwndbg> version
Gdb: GNU gdb (GDB) 8.0.1
Python: 3.6.3 (default, Oct 24 2017, 14:48:20)  [GCC 7.2.0]
Pwndbg: 1.0.0 build: 5811010
```


Discussion:

Resolving patch:
diff --git a/pwndbg/commands/start.py b/pwndbg/commands/start.py
--- a/pwndbg/commands/start.py
+++ b/pwndbg/commands/start.py
@@ -9,6 +9,8 @@
 from __future__ import print_function
 from __future__ import unicode_literals
 
+import shlex
+
 import gdb
 
 import pwndbg.commands
@@ -66,5 +68,5 @@ def entry(*a):
     """
     global break_on_first_instruction
     break_on_first_instruction = True
-    run = 'run ' + ' '.join(a)
+    run = 'run ' + ' '.join(map(shlex.quote, a))
     gdb.execute(run, from_tty=False)
diff --git a/pwndbg/dt.py b/pwndbg/dt.py
--- a/pwndbg/dt.py
+++ b/pwndbg/dt.py
@@ -112,7 +112,8 @@ def dt(name='', addr=None, obj = None):
 
     for name, field in t.items():
         # Offset into the parent structure
-        o     = getattr(field, 'bitpos', 0)/8
+        o     = getattr(field, 'bitpos', 0) // 8
+        b     = getattr(field, 'bitpos', 0) % 8
         extra = str(field.type)
         ftype = field.type.strip_typedefs()
 
@@ -137,7 +138,9 @@ def dt(name='', addr=None, obj = None):
             else:      extra_lines.append(35*' ' + line)
         extra = '\n'.join(extra_lines)
 
-        line  = "    +0x%04x %-20s : %s" % (o, name, extra)
+        bitpos = '' if not b else ('.%i' % b)
+
+        line  = "    +0x%04x%s %-20s : %s" % (o, bitpos, name, extra)
         rv.append(line)
 
     return ('\n'.join(rv))
diff --git a/pwndbg/prompt.py b/pwndbg/prompt.py
--- a/pwndbg/prompt.py
+++ b/pwndbg/prompt.py
@@ -33,4 +33,5 @@ def prompt_hook_on_stop(*a):
     pwndbg.commands.context.context()
 
 
+
 gdb.prompt_hook = prompt_hook


Test patch: