title: How to debug in kernel mode using printk
body: <p>I am trying to add some stuff to Linux <code>task_struct</code>.</p>
  
  <p>In this area I copy a string from the user and try to store it in my struct.</p>
  
  <p>I try to debug my code by adding <code>printk</code> that will print the copied string.</p>
  
  <p>this is the debuging part of the code:</p>
  
  <pre><code>newTODO-&gt;TODO_description=(char*)(kmalloc(in_description_size+1,0));
      if( newTODO-&gt;TODO_description){
          kfree(newTODO);
          return -1;
      }
  
      res=copy_from_user(newTODO-&gt;TODO_description, in_TODO_description, in_description_size);
          if (res)                                //  error copying from user space, 1 or more char werent copied.
          {
              printk(KERN_ALERT "function: create element failed to copy from user\n");
              return -EFAULT;
          }
      newTODO-&gt;TODO_description[in_description_size]='\o';
      printk(KERN_ALERT "the copied string is: %s \n",newTODO-&gt;TODO_description);
  </code></pre>
  
  <p>the must inportent print for me is </p>
  
  <pre><code>printk(KERN_ALERT "the copied string is: %s \n",newTODO-&gt;TODO_description);
  </code></pre>
  
  <p>will it work?</p>
  
  <p>to understand printk:</p>
  
  <p>when i will run my test file from the terminal whenever the printk will be invoked it will print the output right to the working terminal?</p>