Tag Info

Hot answers tagged

16

There isn't a universal way, but you can make an educated guess by looking for things only done by one compiler. GCC is the easiest; it writes a .comment section that contains the GCC version string (the same string you get if you run gcc --version). I don't know if there's a way to display it with readelf, but with objdump it's: objdump -s --section ...


12

My personal flavor for Linux Kernel development is Debian. Now for your points: As you probably guessed Ubuntu doesn't bring nothing new to kernel ease kernel development afaik, apart from what's already available in Debian. For e.g. make_kpkg is a Debian feat. and not Ubuntu. Here are some links to get you started on common Linux Kernel development tasks ...


10

If you can change the source code, Dmalloc is great; it will list which pointers were unfreed and (for code built with debugging symbols) exactly which line they were allocated on. If you can't, Valgrind is pretty much the standard for that sort of thing. I generally find Valgrind somewhat harder to use, but it has way more features and doesn't involve ...


10

This reference seems to have answers to your questions, titled: Linux Kernel Development Second Edition. excerpt printk() The kernel print function, printk(), behaves almost identically to the C library printf() function. Indeed, throughout this book we have not made use of any real differences. For most intentions, this is fine; printk() is simply ...


9

You can only debug a setuid or setgid program if the debugger is running as root. The kernel won't let you call ptrace on a program running with extra privileges. If it did, you would be able to make the program execute anything, which would effectively mean you could e.g. run a root shell by calling a debugger on /bin/su. If you run Gdb as root, you'll be ...


9

You've asked way too much in one question—well, technically not, as I guess "is this understanding correct" can be answered quickly: no. But that's not a useful answer. First, you're right about ata_piix and sd_mod apparently being compiled-in to your kernel. That's a choice you make configuring the kernel—you can omit it, include it, or include it as a ...


8

The methods will depend on the kind of the problem. In general "How To Ask Questions The Smart Way" by Eric S. Raymond and Rick Moen is sometimes a helpful advice to focus on the problem and to check if you have thought about important parts of the problem. Your first source of information during debugging are the logfiles your system/application writes. ...


8

There is a system call named ptrace. It takes 4 parameters: the operation, the PID of the target process, an address in the target process memory, and a data pointer. The way the last 2 parameters are used is dependent on the operation. For example you can attach/detach your debugger to a process: ptrace(PTRACE_ATTACH, pid, 0, 0); ... ptrace(PTRACE_DETACH, ...


8

There are many ways to handle suspend and hibernate capabilities, many of the old methods are deprecated. This has made searching for solutions difficult, as it seems every solution is completely unrelated to the next. With that said... The method currently recommended, advocated from http://pm-utils.freedesktop.org/wiki/, should be available for most ...


7

xtrace output goes to stderr, so you could redirect stderr to /dev/null: ikwtd() { echo do stuff } 2> /dev/null If you still want to see the errors from the commands run inside the functions, you could do ikwtd() ( set +x exec 2>&3 3>&- echo do stuff ) 3>&2 2> /dev/null See also this locvar.sh which contains a few ...


6

First things first, debug the module? Just see if you can load it up in gdb it might point you straight at a line that uses the relevant variable(or close to it). oh, and you might find this article useful


6

I think, general principles of network troubleshooting are: Find out at what level of TCP/IP stack(or some other stack) occurs the problem. Understand what is the correct system behavior, and what is deviation from normal system state Try to express the problem in one sentence or in several words Using obtained information from buggy system, your own ...


6

Use less. Start less on the text file you want to monitor: less some_file If you want to search for a pattern, ues a slash to start a search a pattern: /<pattern> # forward search ?<pattern> # backward search If you want to filter the output use an ampersand: &<pattern> Then start the continuous output using shiftf. You can ...


5

Arch is a DIY distro: there is no automated tool for bug reporting. There is, however, comprehensive guidance on the Arch Wiki for reporting bugs. The philosophy of Arch, the Arch Way, stresses self-sufficiency and a willingness to contribute solutions, which means actively participating in bug reporting and squashing. This doesn't fit well with an ...


5

Sometimes ltrace works. In general, this calls for a debugger such as GDB. You can get an idea of which functions to put trace points or break points on by looking at the call structure in the disassembly (objdump -d /path/to/executable).


4

You can try using the strings command. It will create a lot of text output; by checking it you might guess the compiler. pubuntu@pubuntu:~$ strings -a a.out |grep -i gcc GCC: (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Here I know it's compiled with gcc but you can always redirect strings output to a file and examine it. There is one very good utility called peid ...


4

I'm one of the authors of that patch, sorry it is so buggy :) In general to find null pointers like this I just insert printks until I find the pointer that is null (=0), then I read the source code until I find out why. However in this case I know that you have to disable framebuffer console or you'll get this nasty bug, which is only triggered when the ...


4

The usual trick is to have something (possibly a signal like SIGUSR1) trigger the program to fork(), then the child calls abort() to make itself dump core. from os import fork, abort (...) def onUSR1(sig, frame): if os.fork == 0: os.abort and during initialization from signal import signal, SIGUSR1 from wherever import onUSR1 (...) ...


4

run ulimit -c 1073741824 prior to starting the program. Next time the program crashes, a core dump will be created in the working directory (named core.). You can then use GDB to open this core at any time you like. ulimit -c XXXXX sets the maximum size of the core dump file created when a program seg faults. By default this is '0' which means not to dump ...


4

Uh, how do you know about the segfault anyway? There is a kernel log message at priority info. It shows the executable name without the directory part. On some architectures, the debug.exception-trace sysctl must be set. Some architectures require a compile-time option and kernel command line parameter (e.g. CONFIG_USER_DEBUG and user_debug on arm).


4

Somewhere in your ppp setup (probably either in /etc/ppp/options or at the command line), you have an option called connect followed by a command used to setup the modem for a connection. It's usually a chat script. You need to find out why that command is failing. If it is a chat script, you can make it verbose by changing it from chat blah blah... to chat ...


4

I had the same problem on Linux Mint 13 and the same output on xev, namely Control_l + f was mapped to Control_l. My solution: I remembered that I have xbindkeys running to enable some exotic buttons on my tablet pc. By running xbindkeys-config and checking all key mappings defined for xbindkeys I found an entry that interfered with CTRL-F. After ...


4

If you think about how strace works then it makes total sense that none of the builtins to Bash would be traceable. strace can only trace actual executables, whereas the builtins are not. For example, my cd command: $ type cd cd is a function cd () { builtin cd "$@"; local result=$?; __rvm_project_rvmrc; __rvm_after_cd; return ...


4

As an approximation, you could do: trap '{ type -p -- "${BASH_COMMAND%% *}" >&3; } 3>&2 2> /dev/null' DEBUG set -o functrace -o xtrace The DEBUG trap is run before every command. During the execution of that trap, $BASH_COMMAND is set to the current command. That includes function calls, builtins, assignments... We call type -p on the ...


3

From a debugging perspective, the kernel is a special "process", distinct from the user space processes, which communicate with the kernel via a sort of rpc mechanism (syscalls) or mapped memory.. I don't think you can see the kernel's data structure simply by inspecting some random user process. Another problem is, that every user space process ...


3

PM_DEBUG and PM_TRACE are apparently the deepest debugging facilities there are right now. When you're getting nothing meaningful from higher level logs, AFAIK this is the only mechanism to fall back on when encountering the dreaded "mysterious blank screen on resume" symptom. Most often we're dealing with a, quite often subtly, broken device driver. You can ...


3

If you want a single, general principle for debugging, it would be this: Understand how the system works, as much as you can. Understand each component of the system, and the failure modes of each component. Be aware of which components you have changed recently, and which components may have changed or failed on their own. If you were looking for ...


3

atop is pretty good at monitoring and logging resource usage. It can be used interactively or as a service; the debian package sets it to log to /var/log/atop.log every ten minutes (edit /etc/init.d/atop for something more precise). You can then replay the logs with atop -r /var/log/atop.log -b hh:mm -mM; mM selects a view and a sort appropriate for memory ...


3

The file /proc/$pid/stacks shows kernel stacks. On your system, memory addresses of the form ffffffff8xxxxxxx are in the space that's reserved for the kernel. There's not much documentation, you can check the source code. In contracst, the pstack program shows user-space stacks (using its knowledge of executable formats).


3

Try this as root: PM_DEBUG=true pm-suspend Then check /var/log/pm-suspend.log for hints on what might go wrong. If you can suspend, but not resume, there's a good article on the Ubuntu wiki on how to debug this problem.



Only top voted, non community-wiki answers of a minimum length are eligible