gdb

GDB compilation fails with MSYS2 under Windows

岁酱吖の 提交于 2021-01-29 08:02:28
问题 I need to compile GDB for OS Linux targets but with Windows host OS. (The goal is to have possibility to run GDB client on Windows and connect it to the gdbserver running on Linux). I'm using GDB sources v 9.2 and the following configure command: ../configure --build=x86_64-w64-mingw64 --target=x86_64-unknown-linux-gnu It's running from the build directory inside gdb golder. And I'm getting the following error: mkdir -p -- nat/.deps CXX gdb.o CXX ada-exp.o ada-exp.y: In function 'int ada

ICEBP assembly instruction

坚强是说给别人听的谎言 提交于 2021-01-29 05:19:41
问题 As a workaround with x86 instructions, I used an opcode looks like .byte 0xf1, 0xc1 and tried to execute that inside gdb. the disassembly of that line shows f1 icebp So, when first byte which is F1 is fetched it is recognized as an instruction called icebp . This is known to be an undocumented instruction. The only thing I found in the SDM, is a footnote in INT sections saying The mnemonic ICEBP has also been used for the instruction with opcode F1 Continuing with gdb, it says Cannot access

schedBreak(<tick>) gdb debugging function not working

若如初见. 提交于 2021-01-28 21:15:00
问题 I am trying to create breakpoints and debug gem5 using gdb. I referred to http://www.gem5.org/Debugger_Based_Debugging. As in the official documentation in the above link, I tried `call schedBreak() but it doesn't work. the following are the full commands: ➜ test-gem5-x86 git:(master) ✗ gdb --args ./build/X86/gem5.opt configs/learning_gem5/part1/simple.py GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or

Step into function call in gdb but not calls for parameters

牧云@^-^@ 提交于 2021-01-28 17:36:01
问题 I would like to step into the function GDB is currently at, but not into the functions that are called to prepare the parameters for the call. Is there a single command in gdb that steps over functions like initial_metadata_flags() and directly into SendInitialMetadata ? void StartCallInternal() { > single_buf.SendInitialMetadata(&context_->send_initial_metadata_, context_->initial_metadata_flags()); } If there is, I did not see it mentioned here: https://sourceware.org/gdb/onlinedocs/gdb

Why Segment fault when writing to writeable .data section? Using Ubuntu, x86, nasm, gdb, readelf

给你一囗甜甜゛ 提交于 2021-01-28 09:01:13
问题 I'm learning to write a simple shell code using assembly. I get a Segment fault when the mov opcode executes to write over the db data. Why? Any guidance appreciated! Debugging with gdb confirms the data is contiguous with the code at run time and readelf analysis of the program confirms the data segment is writeable. section .text global _start _start: ; The following code calls execve("/bin/sh", argv, envp=0) jmp short two one: pop ebx xor eax, eax mov [ebx+12], eax mov [ebx+7], al mov [ebx

GDB: disable printing of current line after every step

孤街浪徒 提交于 2021-01-28 08:51:42
问题 The GNU gdb commandline debugger prints the line it is currently on after every step and next command. Consider the following gdb session where I step through some code: ... Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd848) at src/main.cc:3 3 int main(int argc, char **argv){ (gdb) next 4 Printf("Hello World\n"); // <--- disable this (gdb) 5 printf("Hello World 2\n"); // <--- disable this (gdb) Is there a gdb setting to disable this printing? I know this is technically possible

Cannot load shared libraries in gdb

你离开我真会死。 提交于 2021-01-28 06:47:00
问题 I'm trying to run application in gdb but it seem's I have problem with debbuger. I cannot load shared libraries all the ways I've tried to. Libraries are stored in /usr/local/lib64 and environment is ok: echo $LD_LIBRARY_PATH /usr/local/lib64:/home/user/lib When I run appllication in gdb , the following happens: (gdb) set solib-search-path /usr/local/lib64 (gdb) show solib-search-path The search path for loading non-absolute shared library symbol files is /usr/local/lib64. (gdb) info

Why does calling calloc in gdb not appear to zero out the memory?

蹲街弑〆低调 提交于 2021-01-27 12:44:22
问题 I'm doing some experimentation with editing a process memory while it's running, and I noticed when I call calloc in a gdb'd process, the call seems to work and return the original passed pointer, but the memory does not appear to be initialized to 0 : (gdb) call calloc(1, 32) $88 = (void *) 0x8d9d50 (gdb) x/8xw 0x8d9d50 0x8d9d50: 0xf74a87d8 0x00007fff 0xf74a87d8 0x00007fff 0x8d9d60: 0xfbfbfbfb 0xfbfbfbfb 0x00000000 0x9b510000 If I call memset on the resulting pointer, however, the

pretty print not working for c++ stl list

跟風遠走 提交于 2021-01-27 12:24:56
问题 While using gdb for the following code, it appears that pretty print works as expected for stl vector and strings but the output for list seems cryptic. list<int> l; string a = "Hello"; vector<int> v(2,3); l.push_back(5); l.push_back(10); Output of gdb pretty print: (gdb) set print pretty on (gdb) disp v 1: v = std::vector of length 2, capacity 2 = {3, 3} (gdb) disp a 2: a = "Hello" (gdb) disp l 3: l = { <std::__cxx11::_List_base<int, std::allocator<int> >> = { _M_impl = { <std::allocator<std

GDB - strcmp not working: __strcmp_sse2_unaligned

痞子三分冷 提交于 2021-01-27 10:48:01
问题 I'm unable to create conditional breakpoint in GDB using strcmp: break x if strcmp(str.c_str(), "foo") == 0 Why you ask? Because: print strcmp("hello", "hello") Yield's (int (*)(const char *, const char *)) 0x7ffff76ffe70 <__strcmp_sse2_unaligned> Even when casting it to an integer: print (int)strcmp("hello", "hello") It returns some nonsensical value like -143655312 Here's a less graceful way to "solve" my problem. I can define a function in my own code: int mystrcmp(const char *str1, const