We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Feature request: RVA-based breakpoints
**Is your feature request related to a problem? Please describe.**
I am missing a command that would allow creating a breakpoint relative to some image - either main program or a library - for example at offset 0x1337 from libc base.

**Describe the solution you'd like**
A new command that would enable this, for example

````
bp libc.so+0x1337
````


**Describe alternatives you've considered**
The alternative is to manually find the image bases which is tedious.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pwndbg/gdblib/functions.py`
Content:
```
1 """
2 Put all functions defined for gdb in here.
3 
4 This file might be changed into a module in the future.
5 """
6 
7 from __future__ import annotations
8 
9 import functools
10 from typing import Any
11 from typing import Callable
12 from typing import List
13 
14 import gdb
15 
16 import pwndbg.gdblib.elf
17 import pwndbg.gdblib.proc
18 
19 functions: List[_GdbFunction] = []
20 
21 
22 def GdbFunction(only_when_running: bool = False) -> Callable[..., Any]:
23     return functools.partial(_GdbFunction, only_when_running=only_when_running)
24 
25 
26 class _GdbFunction(gdb.Function):
27     def __init__(self, func: Callable[..., Any], only_when_running: bool) -> None:
28         self.name = func.__name__
29         self.func = func
30         self.only_when_running = only_when_running
31 
32         functions.append(self)
33 
34         super().__init__(self.name)
35 
36         functools.update_wrapper(self, func)
37         self.__doc__ = func.__doc__
38 
39     def invoke(self, *args: gdb.Value) -> Any:
40         if self.only_when_running and not pwndbg.gdblib.proc.alive:
41             # Returning empty string is a workaround that we can't stop e.g. `break *$rebase(offset)`
42             # Thx to that, gdb will print out 'evaluation of this expression requires the target program to be active'
43             return ""
44 
45         return self.func(*args)
46 
47     def __call__(self, *args: gdb.Value) -> Any:
48         return self.invoke(*args)
49 
50 
51 @GdbFunction(only_when_running=True)
52 def rebase(addr: gdb.Value | int) -> int:
53     """Return rebased address."""
54     base = pwndbg.gdblib.elf.exe().address
55     return base + int(addr)
56
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pwndbg/gdblib/functions.py b/pwndbg/gdblib/functions.py
--- a/pwndbg/gdblib/functions.py
+++ b/pwndbg/gdblib/functions.py
@@ -53,3 +53,16 @@
     """Return rebased address."""
     base = pwndbg.gdblib.elf.exe().address
     return base + int(addr)
+
+
+@GdbFunction(only_when_running=True)
+def base(name_pattern: gdb.Value | str) -> int:
+    if isinstance(name_pattern, gdb.Value):
+        name = name_pattern.string()
+    else:
+        name = name_pattern
+
+    for p in pwndbg.gdblib.vmmap.get():
+        if name in p.objfile:
+            return p.vaddr
+    raise ValueError(f"No mapping named {name}")

{"golden_diff": "diff --git a/pwndbg/gdblib/functions.py b/pwndbg/gdblib/functions.py\n--- a/pwndbg/gdblib/functions.py\n+++ b/pwndbg/gdblib/functions.py\n@@ -53,3 +53,16 @@\n     \"\"\"Return rebased address.\"\"\"\n     base = pwndbg.gdblib.elf.exe().address\n     return base + int(addr)\n+\n+\n+@GdbFunction(only_when_running=True)\n+def base(name_pattern: gdb.Value | str) -> int:\n+    if isinstance(name_pattern, gdb.Value):\n+        name = name_pattern.string()\n+    else:\n+        name = name_pattern\n+\n+    for p in pwndbg.gdblib.vmmap.get():\n+        if name in p.objfile:\n+            return p.vaddr\n+    raise ValueError(f\"No mapping named {name}\")\n", "issue": "Feature request: RVA-based breakpoints\n**Is your feature request related to a problem? Please describe.**\r\nI am missing a command that would allow creating a breakpoint relative to some image - either main program or a library - for example at offset 0x1337 from libc base.\r\n\r\n**Describe the solution you'd like**\r\nA new command that would enable this, for example\r\n\r\n````\r\nbp libc.so+0x1337\r\n````\r\n\r\n\r\n**Describe alternatives you've considered**\r\nThe alternative is to manually find the image bases which is tedious.\r\n\n", "before_files": [{"content": "\"\"\"\nPut all functions defined for gdb in here.\n\nThis file might be changed into a module in the future.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport functools\nfrom typing import Any\nfrom typing import Callable\nfrom typing import List\n\nimport gdb\n\nimport pwndbg.gdblib.elf\nimport pwndbg.gdblib.proc\n\nfunctions: List[_GdbFunction] = []\n\n\ndef GdbFunction(only_when_running: bool = False) -> Callable[..., Any]:\n    return functools.partial(_GdbFunction, only_when_running=only_when_running)\n\n\nclass _GdbFunction(gdb.Function):\n    def __init__(self, func: Callable[..., Any], only_when_running: bool) -> None:\n        self.name = func.__name__\n        self.func = func\n        self.only_when_running = only_when_running\n\n        functions.append(self)\n\n        super().__init__(self.name)\n\n        functools.update_wrapper(self, func)\n        self.__doc__ = func.__doc__\n\n    def invoke(self, *args: gdb.Value) -> Any:\n        if self.only_when_running and not pwndbg.gdblib.proc.alive:\n            # Returning empty string is a workaround that we can't stop e.g. `break *$rebase(offset)`\n            # Thx to that, gdb will print out 'evaluation of this expression requires the target program to be active'\n            return \"\"\n\n        return self.func(*args)\n\n    def __call__(self, *args: gdb.Value) -> Any:\n        return self.invoke(*args)\n\n\n@GdbFunction(only_when_running=True)\ndef rebase(addr: gdb.Value | int) -> int:\n    \"\"\"Return rebased address.\"\"\"\n    base = pwndbg.gdblib.elf.exe().address\n    return base + int(addr)\n", "path": "pwndbg/gdblib/functions.py"}], "after_files": [{"content": "\"\"\"\nPut all functions defined for gdb in here.\n\nThis file might be changed into a module in the future.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport functools\nfrom typing import Any\nfrom typing import Callable\nfrom typing import List\n\nimport gdb\n\nimport pwndbg.gdblib.elf\nimport pwndbg.gdblib.proc\n\nfunctions: List[_GdbFunction] = []\n\n\ndef GdbFunction(only_when_running: bool = False) -> Callable[..., Any]:\n    return functools.partial(_GdbFunction, only_when_running=only_when_running)\n\n\nclass _GdbFunction(gdb.Function):\n    def __init__(self, func: Callable[..., Any], only_when_running: bool) -> None:\n        self.name = func.__name__\n        self.func = func\n        self.only_when_running = only_when_running\n\n        functions.append(self)\n\n        super().__init__(self.name)\n\n        functools.update_wrapper(self, func)\n        self.__doc__ = func.__doc__\n\n    def invoke(self, *args: gdb.Value) -> Any:\n        if self.only_when_running and not pwndbg.gdblib.proc.alive:\n            # Returning empty string is a workaround that we can't stop e.g. `break *$rebase(offset)`\n            # Thx to that, gdb will print out 'evaluation of this expression requires the target program to be active'\n            return \"\"\n\n        return self.func(*args)\n\n    def __call__(self, *args: gdb.Value) -> Any:\n        return self.invoke(*args)\n\n\n@GdbFunction(only_when_running=True)\ndef rebase(addr: gdb.Value | int) -> int:\n    \"\"\"Return rebased address.\"\"\"\n    base = pwndbg.gdblib.elf.exe().address\n    return base + int(addr)\n\n\n@GdbFunction(only_when_running=True)\ndef base(name_pattern: gdb.Value | str) -> int:\n    if isinstance(name_pattern, gdb.Value):\n        name = name_pattern.string()\n    else:\n        name = name_pattern\n\n    for p in pwndbg.gdblib.vmmap.get():\n        if name in p.objfile:\n            return p.vaddr\n    raise ValueError(f\"No mapping named {name}\")\n", "path": "pwndbg/gdblib/functions.py"}]}