Questions tagged [debugging]

is a process of finding and reducing the number of bugs, or defects, in a computer program, thus making it behave as expected

454 questions
311
votes
11 answers

how can I make cron run a job right now, for testing/debugging? without changing the schedule!

I have a cron job that is scheduled to run everyday, other than changing the schedule, is there any other way to do a test run of the command right now to see if it works as intended? EDIT: (from the comments) I know the command works fine when…
Ali
  • 6,693
  • 6
  • 32
  • 37
221
votes
8 answers

How to debug a bash script?

I'm having some problems with some scripts in bash, about errors and unexpected behaviors. I would like to investigate the causes of the problems so I can apply fixes. Is there a way I can turn some kind of "debug-mode" for bash, to get more…
Braiam
  • 35,380
  • 25
  • 108
  • 167
92
votes
3 answers

Linux network troubleshooting and debugging

From time to time, Linux and Unix users are faced with various network problems. Many of these problems are presented here and at some other troubleshooting forums, but they are very concrete and contain a lot of additional technical information,…
dr.
  • 2,351
  • 3
  • 16
  • 9
90
votes
3 answers

How to step-into, step-over and step-out with GDB?

I typed help while I was in the GDB but didn't find anything about step-into, step-over and step-out. I put a breakpoint in an Assembly program in _start (break _start). Afterwards I typed next and it finished the debugging. I guess it was because…
Pichi Wuana
  • 1,159
  • 2
  • 9
  • 10
67
votes
9 answers

Can we get compiler information from an elf binary?

Is there some chance to know how a binary was built, under Linux? (and or other Unix) Compiler, version, time, flags etc... I looked at readelf and couldn't find much, but there might be other ways at analyzing the binary code/section…
elmarco
  • 1,434
  • 1
  • 14
  • 13
59
votes
5 answers

How to know where a program is stuck in linux?

I am running the following command on my ubuntu server root@slot13:~# lxc-stop --name pavan --logfile=test1.txt --logpriority=trace It seems to hang indefinitely. Whenever this happened on AIX, I simply used to get the PID of the offending process…
Pavan Manjunath
  • 769
  • 2
  • 7
  • 13
53
votes
4 answers

How did `git pull` eat my homework?

I feel like a kid in the principal's office explaining that the dog ate my homework the night before it was due, but I'm staring some crazy data loss bug in the face and I can't figure out how it happened. I would like to know how git could eat my…
Caleb
  • 69,278
  • 18
  • 196
  • 226
50
votes
2 answers

Running application ends with "Segmentation Fault"

I have a command line application that when run does not do what it is supposed to do and at a certain point leaves the message: Segmentation fault What does this mean? What should I do?
goldilocks
  • 86,451
  • 30
  • 200
  • 258
37
votes
5 answers

How to view core files for debugging purposes in Linux?

I want to view the contents of a core file while debugging a program. How can I view the contents of a core file?
Özzesh
  • 3,549
  • 8
  • 23
  • 25
34
votes
3 answers

How can I see the exact command line being executed inside some bash instance?

I have a long running bash instance (inside a screen session) that is executing a complex set of commands inside a loop (with each loop doing pipes, redirects, etc). The long command line was written inside the terminal - it's not inside any…
ttsiodras
  • 2,301
  • 1
  • 21
  • 26
28
votes
2 answers

Tools for Debugging Routing Tables on a Linux Machine?

Is there a tool that debugs routing tables on a Linux machine? I mean one that I can use by inputting an ip address into it, it'll take the existing routing table into account and output the matches from the table, so I can get an idea where the…
leeand00
  • 4,443
  • 10
  • 51
  • 78
27
votes
4 answers

How can I see what command was actually run in the shell, through an alias or function

I have a bash function (or alias), for instance function install() {sudo apt-get install $@}. When running the command install dicelab, what I expect will actually be run is sudo apt-get install dicelab. Where can I see what was actually run by the…
Alon Aviv
  • 279
  • 3
  • 4
26
votes
4 answers

How to compile without optimizations -O0 using CMake

I am using Scientific Linux (SL). I am trying to compile a project that uses a bunch of C++ (.cpp) files. In the directory user/project/Build, I enter make to compile and link all the .cpp files. I then have to go to user/run/ and then type…
user4352158
  • 431
  • 2
  • 6
  • 9
25
votes
1 answer

Any way to have a "verbose mode" or "debug mode" with sed?

Is there a way to make gnu sed be verbose about what is run and what is done ? I'd like to have something like a "debug mode" so that I can see - for each line of input - the content of the hold space and pattern space before and after the script is…
don_crissti
  • 79,330
  • 30
  • 216
  • 245
24
votes
1 answer

Debugging scripts, what is the difference between -x to set -euxo pipefail?

The main way I know to debug scripts is adding -x to the shabang (#!/bin/bash -x). I recently came across a new way, adding set -euxo pipefail right under the shabang, as in: #!/bin/bash set -euxo pipefail What is the main difference between the…
user149572
1
2 3
30 31