eGospodarka.pl
eGospodarka.pl poleca

eGospodarka.plGrupypl.comp.programming › problem z if przy debugowaniu w VSCode
Ilość wypowiedzi w tym wątku: 5

  • 1. Data: 2020-04-15 19:53:36
    Temat: problem z if przy debugowaniu w VSCode
    Od: RM <r...@w...pl>

    Mam problemik przy debugowaniu w VSCode pod Linuxem.
    Mam taki kod w C++:

    if (m + 1 < matches2.size() - 1) {
    next_start = strstr(next.c_str(), matches2.str(m + 1).c_str()) -
    next.c_str();
    } else {
    next_start = next.length();
    }

    i mimo że m = 1 oraz matches2.size() == 5 to debuger wchodzi mi do
    gałęzi else. (Zmienna m jest typu unsigned int a zmienna matches2 typu
    smatch.)
    Jak to możliwe?


  • 2. Data: 2020-04-15 20:32:08
    Temat: Re: problem z if przy debugowaniu w VSCode
    Od: RM <r...@w...pl>

    Dodam że używam debugera: gdb, kompilatora: gcc, standardu języka: C++17.


  • 3. Data: 2020-04-16 06:36:16
    Temat: Re: problem z if przy debugowaniu w VSCode
    Od: RM <r...@w...pl>

    Mam jeszcze jedno pytanie: dlaczego pod debugerem VSCode dla:
    old_line=="function str_split($string, $len = 1) {"
    oraz:
    next=="$string, $len = 1) {"
    mam:
    old_line.find(next)
    Error: Index was outside the bounds of the array.


  • 4. Data: 2020-04-16 15:50:58
    Temat: Re: problem z if przy debugowaniu w VSCode
    Od: RM <r...@w...pl>

    W dniu 15.04.2020 o 19:53, RM pisze:
    > Mam problemik przy debugowaniu w VSCode pod Linuxem.
    > Mam taki kod w C++:
    >
    > if (m + 1 < matches2.size() - 1) {
    >   next_start = strstr(next.c_str(), matches2.str(m + 1).c_str()) -
    > next.c_str();
    > } else {
    >   next_start = next.length();
    > }
    >
    > i mimo że m = 1 oraz matches2.size() == 5 to debuger wchodzi mi do
    > gałęzi else. (Zmienna m jest typu unsigned int a zmienna matches2 typu
    > smatch.)
    > Jak to możliwe?

    Chyba już wiem o co chodziło. W Debug Console znalazłem:
    Warning: Source file
    '/home/robert/dirtyphp/dirtyphp_cpp/src/obfuscator.c
    pp' is newer than
    module file '/home/robert/dirtyphp/dirtyphp_cpp/build/apps/dirty
    php'.


  • 5. Data: 2020-05-15 10:16:59
    Temat: Re: problem z if przy debugowaniu w VSCode
    Od: q...@t...no1 (Queequeg)

    RM <r...@w...pl> wrote:

    > i mimo że m = 1 oraz matches2.size() == 5 to debuger wchodzi mi do
    > gałęzi else. (Zmienna m jest typu unsigned int a zmienna matches2 typu
    > smatch.)
    > Jak to możliwe?

    W gdb jest dobrze. Sprawdź z takim programem.

    (gdb) l
    1 #include <stdio.h>
    2
    3 int main(void)
    4 {
    5 int m = 1, ms = 5;
    6 if (m + 1 < ms - 1)
    7 printf("tak\n");
    8 else
    9 printf("nie\n");
    10 return 0;
    (gdb) b 5
    Breakpoint 1 at 0x10414: file a.c, line 5.
    (gdb) r
    Starting program: /tmp/a

    Breakpoint 1, main () at a.c:5
    5 int m = 1, ms = 5;
    (gdb) s
    6 if (m + 1 < ms - 1)
    (gdb) s
    7 printf("tak\n");
    (gdb)

    --
    https://www.youtube.com/watch?v=9lSzL1DqQn0

strony : [ 1 ]


Szukaj w grupach

Szukaj w grupach

Eksperci egospodarka.pl

1 1 1

Wpisz nazwę miasta, dla którego chcesz znaleźć jednostkę ZUS.

Wzory dokumentów

Bezpłatne wzory dokumentów i formularzy.
Wyszukaj i pobierz za darmo: