{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":723784969,"defaultBranch":"relocated_base_skiboot","name":"binutils-gdb","ownerLogin":"adi-g15-ibm","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-11-26T18:50:26.000Z","ownerAvatar":"https://github.com/avatars/u/135099846?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1701026969.0","currentOid":""},"activityList":{"items":[{"before":null,"after":"cb50e17766833133437873c87b078662804a495f","ref":"refs/heads/relocated_base_skiboot","pushedAt":"2023-11-26T19:29:29.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"adi-g15-ibm","name":"Aditya Gupta","path":"/adi-g15-ibm","primaryAvatarUrl":"https://github.com/avatars/u/135099846?s=80&v=4"},"commit":{"message":"change the pc value gdb reads from qemu\n\nCurrently we pass `skiboot.lid` to QEMU, but try to debug the same with\n`skiboot.elf` to GDB.\n\nThere is a mismatch between the addresses for same instructions between\nthese files. In case of QEMU, most of the skiboot code is\noffset/relocated by `0x30000000`.\n\nSo the code and instruction we see at `0x22af` in GDB (in skiboot.elf),\nis actually at `0x300022af` in QEMU (running skiboot.lid).\n\nEven with this mismatch, we are able to get assembly instructions from\nQEMU, since that we are reading from QEMU's memory, but anything more\ncomplex doesn't work.\n\n1. Instruction to source code mapping doesn't work.\n\nFix this by modifying the registers that GDB is getting from QEMU.\nSo, if QEMU returns that it's PC is `0x300022af`, we will make GDB think\nthat it is `0x22af`, thus things depending on address to source code\nmapping starts working in GDB.\n\n2. Setting breakpoints at functions doesn't work\n\nThis is since GDB will try to get the instruction address of the\nfunction using debug info from skiboot.elf, which is different from\nruntime address as explained in beginning.\n\nFix it by modifying the breakpoint address that gdb will be sending to\nQEMU.\nDo note, that this causes a problem, that the code doesn't progress at\nall due to SIGTRAP, just do a `stepi`, to force some progress, then we\ncan use whatever we want to use such as `continue` command\n\nSigned-off-by: Aditya Gupta ","shortMessageHtmlLink":"change the pc value gdb reads from qemu"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"startCursor":"Y3Vyc29yOnYyOpK7MjAyMy0xMS0yNlQxOToyOToyOS4wMDAwMDBazwAAAAO4CPOi","endCursor":"Y3Vyc29yOnYyOpK7MjAyMy0xMS0yNlQxOToyOToyOS4wMDAwMDBazwAAAAO4CPOi"}},"title":"Activity ยท adi-g15-ibm/binutils-gdb"}